@hlw-uni/mp-vue 1.1.1 → 1.1.2

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/dist/index.js CHANGED
@@ -709,11 +709,14 @@
709
709
  },
710
710
  emits: ["update:show", "confirm", "cancel"],
711
711
  setup(__props, { emit: __emit }) {
712
+ const props = __props;
712
713
  const emit = __emit;
713
714
  function close() {
714
715
  emit("update:show", false);
715
716
  }
716
717
  function onMask() {
718
+ if (!props.closeOnMask)
719
+ return;
717
720
  close();
718
721
  }
719
722
  function onConfirm() {
@@ -731,7 +734,9 @@
731
734
  onTap: vue.withModifiers(onMask, ["self"])
732
735
  }, [
733
736
  vue.createElementVNode("view", {
734
- class: vue.normalizeClass(["hlw-modal", { "hlw-modal--show": __props.show }])
737
+ class: vue.normalizeClass(["hlw-modal", { "hlw-modal--show": __props.show }]),
738
+ onTap: _cache[0] || (_cache[0] = vue.withModifiers(() => {
739
+ }, ["stop"]))
735
740
  }, [
736
741
  __props.title ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$6, vue.toDisplayString(__props.title), 1)) : vue.createCommentVNode("", true),
737
742
  vue.createElementVNode("view", _hoisted_2$5, [
@@ -742,20 +747,20 @@
742
747
  __props.showCancel ? (vue.openBlock(), vue.createElementBlock("view", {
743
748
  key: 0,
744
749
  class: "hlw-modal-btn hlw-modal-btn--cancel",
745
- onTap: onCancel
750
+ onTap: vue.withModifiers(onCancel, ["stop"])
746
751
  }, vue.toDisplayString(__props.cancelText), 33)) : vue.createCommentVNode("", true),
747
752
  vue.createElementVNode("view", {
748
753
  class: "hlw-modal-btn hlw-modal-btn--confirm",
749
- onTap: onConfirm
754
+ onTap: vue.withModifiers(onConfirm, ["stop"])
750
755
  }, vue.toDisplayString(__props.confirmText), 33)
751
756
  ])
752
757
  ], true)
753
- ], 2)
758
+ ], 34)
754
759
  ], 32)) : vue.createCommentVNode("", true);
755
760
  };
756
761
  }
757
762
  });
758
- const index$7 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-397b9549"]]);
763
+ const index$7 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-91d9e108"]]);
759
764
  const _hoisted_1$5 = {
760
765
  key: 1,
761
766
  class: "hlw-notice-left-icon i-fa6-solid-bullhorn"
package/dist/index.mjs CHANGED
@@ -708,11 +708,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
708
708
  },
709
709
  emits: ["update:show", "confirm", "cancel"],
710
710
  setup(__props, { emit: __emit }) {
711
+ const props = __props;
711
712
  const emit = __emit;
712
713
  function close() {
713
714
  emit("update:show", false);
714
715
  }
715
716
  function onMask() {
717
+ if (!props.closeOnMask)
718
+ return;
716
719
  close();
717
720
  }
718
721
  function onConfirm() {
@@ -730,7 +733,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
730
733
  onTap: withModifiers(onMask, ["self"])
731
734
  }, [
732
735
  createElementVNode("view", {
733
- class: normalizeClass(["hlw-modal", { "hlw-modal--show": __props.show }])
736
+ class: normalizeClass(["hlw-modal", { "hlw-modal--show": __props.show }]),
737
+ onTap: _cache[0] || (_cache[0] = withModifiers(() => {
738
+ }, ["stop"]))
734
739
  }, [
735
740
  __props.title ? (openBlock(), createElementBlock("view", _hoisted_1$6, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
736
741
  createElementVNode("view", _hoisted_2$5, [
@@ -741,20 +746,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
741
746
  __props.showCancel ? (openBlock(), createElementBlock("view", {
742
747
  key: 0,
743
748
  class: "hlw-modal-btn hlw-modal-btn--cancel",
744
- onTap: onCancel
749
+ onTap: withModifiers(onCancel, ["stop"])
745
750
  }, toDisplayString(__props.cancelText), 33)) : createCommentVNode("", true),
746
751
  createElementVNode("view", {
747
752
  class: "hlw-modal-btn hlw-modal-btn--confirm",
748
- onTap: onConfirm
753
+ onTap: withModifiers(onConfirm, ["stop"])
749
754
  }, toDisplayString(__props.confirmText), 33)
750
755
  ])
751
756
  ], true)
752
- ], 2)
757
+ ], 34)
753
758
  ], 32)) : createCommentVNode("", true);
754
759
  };
755
760
  }
756
761
  });
757
- const index$7 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-397b9549"]]);
762
+ const index$7 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-91d9e108"]]);
758
763
  const _hoisted_1$5 = {
759
764
  key: 1,
760
765
  class: "hlw-notice-left-icon i-fa6-solid-bullhorn"
package/dist/style.css CHANGED
@@ -594,7 +594,7 @@ from {
594
594
  to {
595
595
  transform: rotate(360deg);
596
596
  }
597
- }.hlw-modal-mask[data-v-397b9549] {
597
+ }.hlw-modal-mask[data-v-91d9e108] {
598
598
  position: fixed;
599
599
  inset: 0;
600
600
  display: flex;
@@ -602,52 +602,52 @@ to {
602
602
  justify-content: center;
603
603
  background: rgba(0, 0, 0, 0.5);
604
604
  z-index: 1000;
605
- animation: hlw-fade-in-397b9549 0.2s;
605
+ animation: hlw-fade-in-91d9e108 0.2s;
606
606
  }
607
- .hlw-modal[data-v-397b9549] {
607
+ .hlw-modal[data-v-91d9e108] {
608
608
  width: 80%;
609
609
  max-width: 600rpx;
610
610
  background: #fff;
611
611
  border-radius: var(--radius-xl, 32rpx);
612
612
  overflow: hidden;
613
- animation: hlw-scale-in-397b9549 0.25s ease;
613
+ animation: hlw-scale-in-91d9e108 0.25s ease;
614
614
  }
615
- .hlw-modal-title[data-v-397b9549] {
615
+ .hlw-modal-title[data-v-91d9e108] {
616
616
  padding: 40rpx 32rpx 0;
617
617
  text-align: center;
618
618
  font-size: var(--font-md, 32rpx);
619
619
  font-weight: 600;
620
620
  color: #1e293b;
621
621
  }
622
- .hlw-modal-body[data-v-397b9549] {
622
+ .hlw-modal-body[data-v-91d9e108] {
623
623
  padding: 32rpx;
624
624
  font-size: var(--font-base, 28rpx);
625
625
  color: #475569;
626
626
  text-align: center;
627
627
  line-height: 1.6;
628
628
  }
629
- .hlw-modal-footer[data-v-397b9549] {
629
+ .hlw-modal-footer[data-v-91d9e108] {
630
630
  display: flex;
631
631
  border-top: 1rpx solid var(--border-color-light, #f1f5f9);
632
632
  }
633
- .hlw-modal-btn[data-v-397b9549] {
633
+ .hlw-modal-btn[data-v-91d9e108] {
634
634
  flex: 1;
635
635
  padding: 24rpx 0;
636
636
  text-align: center;
637
637
  font-size: var(--font-base, 28rpx);
638
638
  font-weight: 500;
639
639
  }
640
- .hlw-modal-btn[data-v-397b9549]:active {
640
+ .hlw-modal-btn[data-v-91d9e108]:active {
641
641
  background: #f8fafc;
642
642
  }
643
- .hlw-modal-btn--cancel[data-v-397b9549] {
643
+ .hlw-modal-btn--cancel[data-v-91d9e108] {
644
644
  color: #64748b;
645
645
  border-right: 1rpx solid var(--border-color-light, #f1f5f9);
646
646
  }
647
- .hlw-modal-btn--confirm[data-v-397b9549] {
647
+ .hlw-modal-btn--confirm[data-v-91d9e108] {
648
648
  color: var(--primary-color, #3b82f6);
649
649
  }
650
- @keyframes hlw-fade-in-397b9549 {
650
+ @keyframes hlw-fade-in-91d9e108 {
651
651
  from {
652
652
  opacity: 0;
653
653
  }
@@ -655,7 +655,7 @@ to {
655
655
  opacity: 1;
656
656
  }
657
657
  }
658
- @keyframes hlw-scale-in-397b9549 {
658
+ @keyframes hlw-scale-in-91d9e108 {
659
659
  from {
660
660
  transform: scale(0.9);
661
661
  opacity: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hlw-uni/mp-vue",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "hlw-uni Vue 组件库 — 供小程序业务方使用的 UI 组件集合",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -1,14 +1,22 @@
1
1
  <template>
2
2
  <view v-if="show" class="hlw-modal-mask" @tap.self="onMask">
3
- <view class="hlw-modal" :class="{ 'hlw-modal--show': show }">
3
+ <view class="hlw-modal" :class="{ 'hlw-modal--show': show }" @tap.stop>
4
4
  <view v-if="title" class="hlw-modal-title">{{ title }}</view>
5
5
  <view class="hlw-modal-body">
6
6
  <slot />
7
7
  </view>
8
8
  <slot name="footer">
9
9
  <view class="hlw-modal-footer">
10
- <view v-if="showCancel" class="hlw-modal-btn hlw-modal-btn--cancel" @tap="onCancel">{{ cancelText }}</view>
11
- <view class="hlw-modal-btn hlw-modal-btn--confirm" @tap="onConfirm">{{ confirmText }}</view>
10
+ <view
11
+ v-if="showCancel"
12
+ class="hlw-modal-btn hlw-modal-btn--cancel"
13
+ @tap.stop="onCancel"
14
+ >
15
+ {{ cancelText }}
16
+ </view>
17
+ <view class="hlw-modal-btn hlw-modal-btn--confirm" @tap.stop="onConfirm">
18
+ {{ confirmText }}
19
+ </view>
12
20
  </view>
13
21
  </slot>
14
22
  </view>
@@ -16,36 +24,6 @@
16
24
  </template>
17
25
 
18
26
  <script setup lang="ts">
19
- /**
20
- * HlwModal — 模态弹窗
21
- *
22
- * 比 uni.showModal 更灵活:支持插槽自定义内容和底部按钮。
23
- * 使用 v-model:show 控制显隐。
24
- *
25
- * @props
26
- * show - 是否显示,支持 v-model:show
27
- * title - 标题文字
28
- * showCancel - 是否显示取消按钮,默认 true
29
- * confirmText - 确认按钮文字,默认 "确定"
30
- * cancelText - 取消按钮文字,默认 "取消"
31
- * closeOnMask - 点击蒙层是否关闭,默认 true
32
- *
33
- * @events
34
- * update:show - 显隐状态变更
35
- * confirm - 点击确认
36
- * cancel - 点击取消
37
- *
38
- * @slots
39
- * default - 弹窗内容
40
- * footer - 自定义底部按钮区域(覆盖默认确认/取消)
41
- *
42
- * @example
43
- * ```vue
44
- * <HlwModal v-model:show="visible" title="提示" @confirm="onOk">
45
- * <text>确定要删除吗?</text>
46
- * </HlwModal>
47
- * ```
48
- */
49
27
  interface Props {
50
28
  show?: boolean;
51
29
  title?: string;
@@ -55,7 +33,7 @@ interface Props {
55
33
  closeOnMask?: boolean;
56
34
  }
57
35
 
58
- withDefaults(defineProps<Props>(), {
36
+ const props = withDefaults(defineProps<Props>(), {
59
37
  show: false,
60
38
  title: "",
61
39
  showCancel: true,
@@ -71,6 +49,7 @@ function close() {
71
49
  }
72
50
 
73
51
  function onMask() {
52
+ if (!props.closeOnMask) return;
74
53
  close();
75
54
  }
76
55
 
@@ -140,6 +119,7 @@ function onCancel() {
140
119
  color: #64748b;
141
120
  border-right: 1rpx solid var(--border-color-light, #f1f5f9);
142
121
  }
122
+
143
123
  &--confirm {
144
124
  color: var(--primary-color, #3b82f6);
145
125
  }