浏览代码

upd: shortpassword、drag、tabbar、actionsheet (#412)

* upd: drag,shortpassword

* upd: tabbar,shortpassword,actionsheet

* upd: shortpassword新增方法

Co-authored-by: richard1015 <51844712@qq.com>
Drjingfubo 4 年之前
父节点
当前提交
008cb18edd
共有 3 个文件被更改,包括 35 次插入3 次删除
  1. 8 0
      src/packages/shortpassword/demo.vue
  2. 4 0
      src/packages/shortpassword/doc.md
  3. 23 3
      src/packages/shortpassword/index.vue

+ 8 - 0
src/packages/shortpassword/demo.vue

@@ -10,6 +10,8 @@
       @complete="methods.onComplete"
       @ok="methods.onOk"
       @tips="methods.onTips"
+      @close="methods.close"
+      @cancel="methods.cancel"
     >
     </nut-shortpassword>
     <nut-cell
@@ -92,6 +94,12 @@ export default createDemo({
       onComplete() {},
       onTips() {
         ctx.$toast.text('执行忘记密码逻辑');
+      },
+      close() {
+        ctx.$toast.text('点击icon关闭弹窗');
+      },
+      cancel() {
+        ctx.$toast.text('点击取消按钮关闭弹窗');
       }
     };
 

+ 4 - 0
src/packages/shortpassword/doc.md

@@ -103,6 +103,7 @@ setup() {
 | tips | 提示语| String | 忘记密码|
 | visible | 是否展示短密码框| Boolean | false|
 | value | 密码初始值 | String | ''|
+| close-on-click-overlay | 是否点击遮罩关闭  | Boolean | true|
 | no-button | 是否隐藏底部按钮 |Boolean|true|
 | length | 密码长度,取值为4~6 |String||Number|6|
 | error-msg | 错误信息提示 |String|''|
@@ -114,4 +115,7 @@ setup() {
 |----- | ----- | ----- 
 | change | 输入密码时触发事件 | --
 | ok | 点击确实时触发事件 | value
+| cancel | 点击取消时触发事件| value
+| close | 点击关闭图标时触发事件| value
 | complete | 输入完成的回调 | value
+

+ 23 - 3
src/packages/shortpassword/index.vue

@@ -8,7 +8,8 @@
       }"
       v-model:show="show"
       :closeable="true"
-      @click-close-icon="close"
+      @click-close-icon="closeIcon"
+      :close-on-click-overlay="closeOnClickOverlay"
       @click-overlay="close"
     >
       <view class="nut-shortpsd-title">{{ title }}</view>
@@ -83,12 +84,25 @@ export default create({
       type: Boolean,
       default: true
     },
+    closeOnClickOverlay: {
+      type: Boolean,
+      default: true
+    },
     length: {
       type: [String, Number], //4~6
       default: 6
     }
   },
-  emits: ['update:value', 'update:visible', 'complete', 'change', 'ok', 'tips'],
+  emits: [
+    'update:value',
+    'update:visible',
+    'complete',
+    'change',
+    'ok',
+    'tips',
+    'close',
+    'cancel'
+  ],
   setup(props, { emit }) {
     const realInput = ref(props.value);
     const realpwd = ref();
@@ -122,6 +136,11 @@ export default create({
     }
     function close() {
       emit('update:visible', false);
+      emit('cancel');
+    }
+    function closeIcon() {
+      emit('update:visible', false);
+      emit('close');
     }
     function range(val: number) {
       return Math.min(Math.max(4, val), 6);
@@ -139,7 +158,8 @@ export default create({
       changeValue,
       close,
       onTips,
-      show
+      show,
+      closeIcon
     };
   }
 });