yymini-pop-bottom 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,17 +16,21 @@ or
16
16
  yarn add yymini-pop-bottom
17
17
 
18
18
  然后在 开发者工具中 构建 NPM
19
+ ```
19
20
 
20
- ## 引用
21
+ ## 🎨 引用
21
22
  ```json
22
23
  {
23
24
  "usingComponents": {
24
25
  "pop-bottom": "/miniprogram_npm/yymini-pop-bottom/pop-bottom"
25
26
  }
26
27
  }
28
+ ```
27
29
 
28
- ## use
30
+ ## ▶️ use
29
31
  ```ttml / wxml
30
32
  <pop-bottom visible="{{true}}" title="这里是 title" message="这里是 message" bind:close="onClose" bind:confirm="onConfirm" />
33
+ ```
31
34
 
35
+ ## 👀 示例效果
32
36
  ![弹窗示例](https://raw.githubusercontent.com/AllenGe/yy/main/pop-image.png)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymini-pop-bottom",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "小程序(抖音、微信)-底部确认弹出框自定义组件",
5
5
  "main": "pop-bottom.js",
6
6
  "miniprogram": ".",
package/pop-bottom.js CHANGED
@@ -14,7 +14,7 @@ Component({
14
14
  zindex: {
15
15
  type: Number,
16
16
  value: 999
17
- },
17
+ }, // 控制弹出框层级,默认999
18
18
  title: {
19
19
  type: String,
20
20
  value: ''
@@ -45,20 +45,33 @@ Component({
45
45
  }, // 是否隐藏底部按钮
46
46
  maskCloseable: {
47
47
  type: Boolean,
48
- value: true
48
+ value: false
49
49
  } // 遮罩点击是否关闭
50
50
  },
51
+
51
52
  data: {
52
53
  show: false // 内部维护显示状态,避免异步延迟
53
54
  },
55
+
54
56
  methods: {
57
+ // 遮罩点击:触发关闭
58
+ onMaskClick() {
59
+ if (this.data.maskCloseable) {
60
+ this.triggerEvent('close', {
61
+ type: 'mask'
62
+ }); // 向父组件传事件
63
+ }
64
+ },
65
+
55
66
  // 关闭弹窗:通知页面
56
67
  onClose() {
57
68
  this.triggerEvent('close');
58
69
  },
70
+
59
71
  // 阻止弹窗主体点击穿透到遮罩
60
72
  stopPropagation() {},
61
- // 确认按钮:拼接业务参数透传给页面
73
+
74
+ // 确认按钮:可拼接业务参数透传给页面
62
75
  onConfirm(e) {
63
76
  const baseParams = e.detail || {};
64
77
  const bizParams = {
@@ -66,7 +79,7 @@ Component({
66
79
  ...baseParams
67
80
  };
68
81
  this.triggerEvent('confirm', bizParams);
69
- this.triggerEvent('close'); // 确认后关闭弹窗
70
- }
82
+ },
83
+
71
84
  }
72
85
  });