-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
src/uni_modules/uview-plus/components/u-modal/u-modal.vue
@@ -120,7 +120,7 @@
    * @event {Function} confirm   点击确认按钮时触发
    * @event {Function} cancel      点击取消按钮时触发
    * @event {Function} close      点击遮罩关闭出发,closeOnClickOverlay为true有效
    * @example <u-loadmore :status="status" icon-type="iconType" load-text="loadText" />
    * @example <u-modal :show="show" />
    */
   export default {
      name: 'u-modal',
@@ -137,7 +137,7 @@
            if (n && this.loading) this.loading = false
         }
      },
      emits: ["confirm", "cancel", "close"],
      emits: ["confirm", "cancel", "close", "update:show"],
      methods: {
         addUnit,
         // 点击确定按钮
@@ -145,11 +145,14 @@
            // 如果配置了异步关闭,将按钮值为loading状态
            if (this.asyncClose) {
               this.loading = true;
            } else {
               this.$emit('update:show', false)
            }
            this.$emit('confirm')
         },
         // 点击取消按钮
         cancelHandler() {
            this.$emit('update:show', false)
            this.$emit('cancel')
         },
         // 点击遮罩
@@ -159,6 +162,7 @@
         // 透明遮罩的子元素做了.stop处理,所以点击内容区,也不会导致误触发
         clickHandler() {
            if (this.closeOnClickOverlay) {
               this.$emit('update:show', false)
               this.$emit('close')
            }
         }