@nutui/nutui 4.0.12-beta.1 → 4.0.12

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.
Files changed (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +1 -1
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +50 -50
  135. package/dist/styles/themes/jdb.scss +50 -50
  136. package/dist/styles/themes/jddkh.scss +50 -50
  137. package/dist/styles/themes/jdt.scss +50 -50
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,18 +1,19 @@
1
- import { computed as i, watch as y, resolveComponent as C, openBlock as d, createElementBlock as m, normalizeClass as w, normalizeStyle as V, createElementVNode as c, renderSlot as b, createVNode as h, createCommentVNode as v, Fragment as k, withDirectives as f, toDisplayString as g, vShow as p } from "vue";
2
- import { c as S } from "./component-234624bc.js";
3
- import { Loading1 as B } from "@nutui/icons-vue";
4
- import { _ as N } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { computed, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createVNode, createCommentVNode, Fragment, withDirectives, toDisplayString, vShow } from "vue";
2
+ import { c as createComponent } from "./component-81a4c1d0.js";
3
+ import { Loading1 } from "@nutui/icons-vue";
4
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
5
5
  import "../locale/lang";
6
- const { componentName: $, create: T } = S("switch"), A = T({
7
- components: { Loading1: B },
6
+ const { componentName, create } = createComponent("switch");
7
+ const _sfc_main = create({
8
+ components: { Loading1 },
8
9
  props: {
9
10
  modelValue: {
10
11
  type: [String, Number, Boolean],
11
- default: !1
12
+ default: false
12
13
  },
13
14
  disable: {
14
15
  type: Boolean,
15
- default: !1
16
+ default: false
16
17
  },
17
18
  activeColor: {
18
19
  type: String,
@@ -32,76 +33,88 @@ const { componentName: $, create: T } = S("switch"), A = T({
32
33
  },
33
34
  activeValue: {
34
35
  type: [String, Number, Boolean],
35
- default: !0
36
+ default: true
36
37
  },
37
38
  inactiveValue: {
38
39
  type: [String, Number, Boolean],
39
- default: !1
40
+ default: false
40
41
  },
41
42
  loading: {
42
43
  type: Boolean,
43
- default: !1
44
+ default: false
44
45
  }
45
46
  },
46
47
  emits: ["change", "update:modelValue", "update:loading"],
47
- setup(e, { emit: a }) {
48
- const o = i(() => e.modelValue === e.activeValue), s = i(() => {
49
- const t = $;
48
+ setup(props, { emit }) {
49
+ const isActive = computed(() => props.modelValue === props.activeValue);
50
+ const classes = computed(() => {
51
+ const prefixCls = componentName;
50
52
  return {
51
- [t]: !0,
52
- [o.value ? "nut-switch-open" : "nut-switch-close"]: !0,
53
- [`${t}-disable`]: e.disable,
54
- [`${t}-base`]: !0
53
+ [prefixCls]: true,
54
+ [isActive.value ? "nut-switch-open" : "nut-switch-close"]: true,
55
+ [`${prefixCls}-disable`]: props.disable,
56
+ [`${prefixCls}-base`]: true
55
57
  };
56
- }), r = i(() => ({
57
- backgroundColor: o.value ? e.activeColor : e.inactiveColor
58
- }));
59
- let l = "";
60
- const n = (t) => {
61
- if (e.disable || e.loading)
58
+ });
59
+ const style = computed(() => {
60
+ return {
61
+ backgroundColor: isActive.value ? props.activeColor : props.inactiveColor
62
+ };
63
+ });
64
+ let updateType = "";
65
+ const onClick = (event) => {
66
+ if (props.disable || props.loading)
62
67
  return;
63
- const u = o.value ? e.inactiveValue : e.activeValue;
64
- l = "click", a("update:modelValue", u), a("change", u, t);
68
+ const value = isActive.value ? props.inactiveValue : props.activeValue;
69
+ updateType = "click";
70
+ emit("update:modelValue", value);
71
+ emit("change", value, event);
65
72
  };
66
- return y(
67
- () => e.modelValue,
68
- (t) => {
69
- l == "click" ? l = "" : a("change", t);
73
+ watch(
74
+ () => props.modelValue,
75
+ (v) => {
76
+ if (updateType == "click") {
77
+ updateType = "";
78
+ } else {
79
+ emit("change", v);
80
+ }
70
81
  }
71
- ), {
72
- classes: s,
73
- style: r,
74
- isActive: o,
75
- onClick: n
82
+ );
83
+ return {
84
+ classes,
85
+ style,
86
+ isActive,
87
+ onClick
76
88
  };
77
89
  }
78
- }), L = { class: "nut-switch-button" };
79
- function z(e, a, o, s, r, l) {
80
- const n = C("Loading1");
81
- return d(), m("view", {
82
- class: w(e.classes),
83
- onClick: a[0] || (a[0] = (...t) => e.onClick && e.onClick(...t)),
84
- style: V(e.style)
90
+ });
91
+ const _hoisted_1 = { class: "nut-switch-button" };
92
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
93
+ const _component_Loading1 = resolveComponent("Loading1");
94
+ return openBlock(), createElementBlock("view", {
95
+ class: normalizeClass(_ctx.classes),
96
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
97
+ style: normalizeStyle(_ctx.style)
85
98
  }, [
86
- c("view", L, [
87
- e.loading ? b(e.$slots, "icon", { key: 0 }, () => [
88
- h(n, {
99
+ createElementVNode("view", _hoisted_1, [
100
+ _ctx.loading ? renderSlot(_ctx.$slots, "icon", { key: 0 }, () => [
101
+ createVNode(_component_Loading1, {
89
102
  name: "loading",
90
- color: e.activeColor
103
+ color: _ctx.activeColor
91
104
  }, null, 8, ["color"])
92
- ]) : v("", !0),
93
- e.activeText ? (d(), m(k, { key: 1 }, [
94
- f(c("view", { class: "nut-switch-label open" }, g(e.activeText), 513), [
95
- [p, e.isActive]
105
+ ]) : createCommentVNode("", true),
106
+ _ctx.activeText ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
107
+ withDirectives(createElementVNode("view", { class: "nut-switch-label open" }, toDisplayString(_ctx.activeText), 513), [
108
+ [vShow, _ctx.isActive]
96
109
  ]),
97
- f(c("view", { class: "nut-switch-label close" }, g(e.inactiveText), 513), [
98
- [p, !e.isActive]
110
+ withDirectives(createElementVNode("view", { class: "nut-switch-label close" }, toDisplayString(_ctx.inactiveText), 513), [
111
+ [vShow, !_ctx.isActive]
99
112
  ])
100
- ], 64)) : v("", !0)
113
+ ], 64)) : createCommentVNode("", true)
101
114
  ])
102
115
  ], 6);
103
116
  }
104
- const G = /* @__PURE__ */ N(A, [["render", z]]);
117
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
105
118
  export {
106
- G as default
119
+ index as default
107
120
  };
@@ -1,20 +1,28 @@
1
- var s = Object.defineProperty, l = Object.defineProperties;
2
- var c = Object.getOwnPropertyDescriptors;
3
- var o = Object.getOwnPropertySymbols;
4
- var m = Object.prototype.hasOwnProperty, u = Object.prototype.propertyIsEnumerable;
5
- var r = (e, a, t) => a in e ? s(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t, p = (e, a) => {
6
- for (var t in a || (a = {}))
7
- m.call(a, t) && r(e, t, a[t]);
8
- if (o)
9
- for (var t of o(a))
10
- u.call(a, t) && r(e, t, a[t]);
11
- return e;
12
- }, i = (e, a) => l(e, c(a));
13
- import { inject as d, computed as f, openBlock as y, createElementBlock as b, normalizeClass as v, normalizeStyle as S, renderSlot as K } from "vue";
14
- import { c as $ } from "./component-234624bc.js";
15
- import { _ } from "./_plugin-vue_export-helper-dad06003.js";
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { inject, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from "vue";
21
+ import { c as createComponent } from "./component-81a4c1d0.js";
22
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
16
23
  import "../locale/lang";
17
- const { create: g } = $("tab-pane"), k = g({
24
+ const { create } = createComponent("tab-pane");
25
+ const _sfc_main = create({
18
26
  props: {
19
27
  title: {
20
28
  type: [String, Number],
@@ -26,28 +34,31 @@ const { create: g } = $("tab-pane"), k = g({
26
34
  },
27
35
  disabled: {
28
36
  type: Boolean,
29
- default: !1
37
+ default: false
30
38
  }
31
39
  },
32
40
  emits: ["click"],
33
- setup(e, { emit: a }) {
34
- const t = d("tabsOpiton"), n = f(() => ({
35
- display: t.animatedTime.value == 0 && e.paneKey != t.activeKey.value ? "none" : void 0
36
- }));
37
- return i(p({}, t), {
38
- paneStyle: n
41
+ setup(props, { emit }) {
42
+ const parentOption = inject("tabsOpiton");
43
+ const paneStyle = computed(() => {
44
+ return {
45
+ display: parentOption.animatedTime.value == 0 && props.paneKey != parentOption.activeKey.value ? "none" : void 0
46
+ };
47
+ });
48
+ return __spreadProps(__spreadValues({}, parentOption), {
49
+ paneStyle
39
50
  });
40
51
  }
41
52
  });
42
- function B(e, a, t, n, h, z) {
43
- return y(), b("view", {
44
- class: v(["nut-tab-pane", { inactive: e.paneKey != e.activeKey && e.autoHeight }]),
45
- style: S(e.paneStyle)
53
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
54
+ return openBlock(), createElementBlock("view", {
55
+ class: normalizeClass(["nut-tab-pane", { inactive: _ctx.paneKey != _ctx.activeKey && _ctx.autoHeight }]),
56
+ style: normalizeStyle(_ctx.paneStyle)
46
57
  }, [
47
- K(e.$slots, "default")
58
+ renderSlot(_ctx.$slots, "default")
48
59
  ], 6);
49
60
  }
50
- const w = /* @__PURE__ */ _(k, [["render", B]]);
61
+ const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
51
62
  export {
52
- w as default
63
+ TabPane as default
53
64
  };
@@ -1,8 +1,9 @@
1
- import { toRefs as h, ref as i, reactive as m, provide as b, watch as v, onMounted as g, nextTick as y, openBlock as V, createElementBlock as C, normalizeClass as f, normalizeStyle as B, createElementVNode as S, renderSlot as _ } from "vue";
2
- import { c as $ } from "./component-234624bc.js";
3
- import { _ as w } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { toRefs, ref, reactive, provide, watch, onMounted, nextTick, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot } from "vue";
2
+ import { c as createComponent } from "./component-81a4c1d0.js";
3
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
4
4
  import "../locale/lang";
5
- const { create: k } = $("tabbar"), I = k({
5
+ const { create } = createComponent("tabbar");
6
+ const _sfc_main = create({
6
7
  props: {
7
8
  modelValue: {
8
9
  type: [Number, String],
@@ -10,7 +11,7 @@ const { create: k } = $("tabbar"), I = k({
10
11
  },
11
12
  bottom: {
12
13
  type: Boolean,
13
- default: !1
14
+ default: false
14
15
  },
15
16
  type: {
16
17
  type: String,
@@ -26,60 +27,70 @@ const { create: k } = $("tabbar"), I = k({
26
27
  },
27
28
  safeAreaInsetBottom: {
28
29
  type: Boolean,
29
- default: !1
30
+ default: false
30
31
  },
31
32
  placeholder: {
32
33
  type: Boolean,
33
- default: !1
34
+ default: false
34
35
  }
35
36
  },
36
37
  emits: ["tab-switch", "update:modelValue"],
37
- setup(e, { emit: l, slots: p }) {
38
- const { bottom: u, placeholder: d } = h(e), n = i(), s = m({
39
- val: e.modelValue,
38
+ setup(props, { emit, slots }) {
39
+ const { bottom, placeholder } = toRefs(props);
40
+ const height = ref();
41
+ const mdValue = reactive({
42
+ val: props.modelValue,
40
43
  children: []
41
- }), a = i(null);
42
- function c(t, r) {
43
- l("update:modelValue", r), o.modelValue = r, l("tab-switch", o.children[t], r);
44
+ });
45
+ const nutTabbar = ref(null);
46
+ function changeIndex(index2, active) {
47
+ emit("update:modelValue", active);
48
+ parentData.modelValue = active;
49
+ emit("tab-switch", parentData.children[index2], active);
44
50
  }
45
- let o = m({
46
- children: s.children,
47
- modelValue: s.val,
48
- unactiveColor: e.unactiveColor,
49
- activeColor: e.activeColor,
50
- changeIndex: c
51
+ let parentData = reactive({
52
+ children: mdValue.children,
53
+ modelValue: mdValue.val,
54
+ unactiveColor: props.unactiveColor,
55
+ activeColor: props.activeColor,
56
+ changeIndex
51
57
  });
52
- return b("parent", o), v(
53
- () => e.modelValue,
54
- (t) => {
55
- o.modelValue = t;
58
+ provide("parent", parentData);
59
+ watch(
60
+ () => props.modelValue,
61
+ (value) => {
62
+ parentData.modelValue = value;
63
+ }
64
+ );
65
+ onMounted(() => {
66
+ if (bottom.value && placeholder.value) {
67
+ nextTick(() => {
68
+ var _a;
69
+ height.value = (_a = nutTabbar == null ? void 0 : nutTabbar.value) == null ? void 0 : _a.getBoundingClientRect().height;
70
+ });
56
71
  }
57
- ), g(() => {
58
- u.value && d.value && y(() => {
59
- var t;
60
- n.value = (t = a == null ? void 0 : a.value) == null ? void 0 : t.getBoundingClientRect().height;
61
- });
62
- }), {
63
- changeIndex: c,
64
- nutTabbar: a,
65
- height: n
72
+ });
73
+ return {
74
+ changeIndex,
75
+ nutTabbar,
76
+ height
66
77
  };
67
78
  }
68
79
  });
69
- function z(e, l, p, u, d, n) {
70
- return V(), C("div", {
71
- class: f({ "nut-tabbar__placeholder": e.bottom && e.placeholder }),
72
- style: B({ height: e.height + "px" })
80
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
81
+ return openBlock(), createElementBlock("div", {
82
+ class: normalizeClass({ "nut-tabbar__placeholder": _ctx.bottom && _ctx.placeholder }),
83
+ style: normalizeStyle({ height: _ctx.height + "px" })
73
84
  }, [
74
- S("view", {
85
+ createElementVNode("view", {
75
86
  ref: "nutTabbar",
76
- class: f(["nut-tabbar", { "nut-tabbar-bottom": e.bottom, "nut-tabbar-safebottom": e.safeAreaInsetBottom }])
87
+ class: normalizeClass(["nut-tabbar", { "nut-tabbar-bottom": _ctx.bottom, "nut-tabbar-safebottom": _ctx.safeAreaInsetBottom }])
77
88
  }, [
78
- _(e.$slots, "default")
89
+ renderSlot(_ctx.$slots, "default")
79
90
  ], 2)
80
91
  ], 6);
81
92
  }
82
- const x = /* @__PURE__ */ w(I, [["render", z]]);
93
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
83
94
  export {
84
- x as default
95
+ index as default
85
96
  };
@@ -1,12 +1,13 @@
1
- import { c as k } from "./component-234624bc.js";
2
- import { r as $ } from "./renderIcon-47498b32.js";
3
- import { inject as I, reactive as B, getCurrentInstance as H, computed as j, resolveComponent as z, openBlock as c, createElementBlock as l, normalizeClass as h, normalizeStyle as N, createVNode as O, normalizeProps as T, guardReactiveProps as D, withCtx as E, createElementVNode as g, renderSlot as y, createCommentVNode as d, createBlock as P, resolveDynamicComponent as R, toDisplayString as x } from "vue";
4
- import { u as V } from "./index-50eed3d9.js";
5
- import C from "./Badge.js";
6
- import { _ as q } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { c as createComponent } from "./component-81a4c1d0.js";
2
+ import { r as renderIcon } from "./renderIcon-3d0fd47c.js";
3
+ import { inject, reactive, getCurrentInstance, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, normalizeProps, guardReactiveProps, withCtx, createElementVNode, renderSlot, createCommentVNode, createBlock, resolveDynamicComponent, toDisplayString } from "vue";
4
+ import { u as useRouter } from "./index-54d03fc1.js";
5
+ import Badge from "./Badge.js";
6
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
7
7
  import "../locale/lang";
8
- const { create: A } = k("tabbar-item"), F = A({
9
- components: { [C.name]: C },
8
+ const { create } = createComponent("tabbar-item");
9
+ const _sfc_main = create({
10
+ components: { [Badge.name]: Badge },
10
11
  props: {
11
12
  tabTitle: {
12
13
  // 标签页的标题
@@ -27,75 +28,95 @@ const { create: A } = k("tabbar-item"), F = A({
27
28
  },
28
29
  to: [Object, String]
29
30
  },
30
- setup(e, { emit: m, slots: u }) {
31
- const p = (n) => u[n], t = I("parent"), i = B({
32
- unactiveColor: t.unactiveColor,
31
+ setup(props, { emit, slots }) {
32
+ const isHaveSlot = (slot) => {
33
+ return slots[slot];
34
+ };
35
+ const parent = inject("parent");
36
+ const state = reactive({
37
+ unactiveColor: parent.unactiveColor,
33
38
  // 未选中的颜色
34
- activeColor: t.activeColor,
39
+ activeColor: parent.activeColor,
35
40
  // 选中的颜色
36
41
  index: 0
37
- }), s = V();
38
- ((n) => {
39
- var o;
40
- if (n.proxy) {
41
- t.children.push(n.proxy);
42
- const r = t.children.indexOf(n.proxy);
43
- i.index = (o = e.name) != null ? o : r;
42
+ });
43
+ const router = useRouter();
44
+ const relation = (child) => {
45
+ var _a;
46
+ if (child.proxy) {
47
+ parent.children.push(child.proxy);
48
+ const index2 = parent.children.indexOf(child.proxy);
49
+ state.index = (_a = props.name) != null ? _a : index2;
50
+ }
51
+ };
52
+ relation(getCurrentInstance());
53
+ const active = computed(() => state.index === parent.modelValue);
54
+ function change() {
55
+ var _a, _b, _c;
56
+ let key = (_a = props.name) != null ? _a : state.index;
57
+ let indexValue = null;
58
+ if (props.name) {
59
+ indexValue = parent.children.findIndex((item) => {
60
+ return item.name == key;
61
+ });
44
62
  }
45
- })(H());
46
- const _ = j(() => i.index === t.modelValue);
47
- function w() {
48
- var v, f, b;
49
- let n = (v = e.name) != null ? v : i.index, o = null;
50
- e.name && (o = t.children.findIndex((a) => a.name == n)), t.changeIndex(o != null ? o : n, i.index);
51
- let r = o != null ? o : n;
52
- if ((f = t.children[r]) != null && f.href) {
53
- window.location.href = t.children[r].href;
63
+ parent.changeIndex(indexValue != null ? indexValue : key, state.index);
64
+ let index2 = indexValue != null ? indexValue : key;
65
+ if ((_b = parent.children[index2]) == null ? void 0 : _b.href) {
66
+ window.location.href = parent.children[index2].href;
54
67
  return;
55
68
  }
56
- if ((b = t.children[r]) != null && b.to) {
57
- let a = t.children[r].to;
58
- a && s ? s.push(a) : location.replace(a);
69
+ if ((_c = parent.children[index2]) == null ? void 0 : _c.to) {
70
+ let to = parent.children[index2].to;
71
+ if (to && router) {
72
+ router.push(to);
73
+ } else {
74
+ location.replace(to);
75
+ }
59
76
  }
60
77
  }
61
78
  return {
62
- state: i,
63
- active: _,
64
- renderIcon: $,
65
- isHaveSlot: p,
66
- change: w
79
+ state,
80
+ active,
81
+ renderIcon,
82
+ isHaveSlot,
83
+ change
67
84
  };
68
85
  }
69
- }), G = { class: "nut-tabbar-item_icon-box" }, J = {
86
+ });
87
+ const _hoisted_1 = { class: "nut-tabbar-item_icon-box" };
88
+ const _hoisted_2 = {
70
89
  key: 0,
71
90
  class: "nut-tabbar-item_icon-box_icon"
72
- }, K = { key: 1 }, L = { key: 0 };
73
- function M(e, m, u, p, t, i) {
74
- const s = z("nut-badge");
75
- return c(), l("div", {
76
- class: h(["nut-tabbar-item", { "nut-tabbar-item__icon--unactive": !e.active }]),
77
- style: N({
78
- color: e.active ? e.state.activeColor : e.state.unactiveColor
91
+ };
92
+ const _hoisted_3 = { key: 1 };
93
+ const _hoisted_4 = { key: 0 };
94
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
95
+ const _component_nut_badge = resolveComponent("nut-badge");
96
+ return openBlock(), createElementBlock("div", {
97
+ class: normalizeClass(["nut-tabbar-item", { "nut-tabbar-item__icon--unactive": !_ctx.active }]),
98
+ style: normalizeStyle({
99
+ color: _ctx.active ? _ctx.state.activeColor : _ctx.state.unactiveColor
79
100
  }),
80
- onClick: m[0] || (m[0] = (S) => e.change())
101
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.change())
81
102
  }, [
82
- O(s, T(D(e.$attrs)), {
83
- default: E(() => [
84
- g("view", G, [
85
- e.isHaveSlot("icon") ? (c(), l("div", J, [
86
- y(e.$slots, "icon", { active: e.active })
87
- ])) : d("", !0),
88
- e.icon && !e.isHaveSlot("icon") ? (c(), l("view", K, [
89
- (c(), P(R(e.renderIcon(e.icon)), { class: "nut-popover-item-img" }))
90
- ])) : d("", !0),
91
- g("view", {
92
- class: h([
103
+ createVNode(_component_nut_badge, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
104
+ default: withCtx(() => [
105
+ createElementVNode("view", _hoisted_1, [
106
+ _ctx.isHaveSlot("icon") ? (openBlock(), createElementBlock("div", _hoisted_2, [
107
+ renderSlot(_ctx.$slots, "icon", { active: _ctx.active })
108
+ ])) : createCommentVNode("", true),
109
+ _ctx.icon && !_ctx.isHaveSlot("icon") ? (openBlock(), createElementBlock("view", _hoisted_3, [
110
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.renderIcon(_ctx.icon)), { class: "nut-popover-item-img" }))
111
+ ])) : createCommentVNode("", true),
112
+ createElementVNode("view", {
113
+ class: normalizeClass([
93
114
  "nut-tabbar-item_icon-box_nav-word",
94
- { "nut-tabbar-item_icon-box_big-word": !e.icon && !e.isHaveSlot("icon") }
115
+ { "nut-tabbar-item_icon-box_big-word": !_ctx.icon && !_ctx.isHaveSlot("icon") }
95
116
  ])
96
117
  }, [
97
- y(e.$slots, "default", {}, () => [
98
- e.tabTitle ? (c(), l("view", L, x(e.tabTitle), 1)) : d("", !0)
118
+ renderSlot(_ctx.$slots, "default", {}, () => [
119
+ _ctx.tabTitle ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.tabTitle), 1)) : createCommentVNode("", true)
99
120
  ])
100
121
  ], 2)
101
122
  ])
@@ -104,7 +125,7 @@ function M(e, m, u, p, t, i) {
104
125
  }, 16)
105
126
  ], 6);
106
127
  }
107
- const te = /* @__PURE__ */ q(F, [["render", M]]);
128
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
108
129
  export {
109
- te as default
130
+ index as default
110
131
  };