@nutui/nutui 3.1.12 → 3.1.15-beta.0

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 (108) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +139 -37
  3. package/dist/nutui.d.ts +8 -1
  4. package/dist/nutui.es.js +2143 -826
  5. package/dist/nutui.umd.js +2155 -831
  6. package/dist/packages/_es/ActionSheet.js +1 -1
  7. package/dist/packages/_es/Address.js +18 -17
  8. package/dist/packages/_es/Avatar.js +1 -1
  9. package/dist/packages/_es/BackTop.js +1 -1
  10. package/dist/packages/_es/Badge.js +1 -1
  11. package/dist/packages/_es/Barrage.js +1 -1
  12. package/dist/packages/_es/Button.js +1 -1
  13. package/dist/packages/_es/Calendar.js +1 -1
  14. package/dist/packages/_es/Card.js +1 -1
  15. package/dist/packages/_es/Cascader.js +547 -0
  16. package/dist/packages/_es/Cell.js +1 -1
  17. package/dist/packages/_es/CellGroup.js +1 -1
  18. package/dist/packages/_es/Checkbox.js +1 -1
  19. package/dist/packages/_es/CheckboxGroup.js +1 -1
  20. package/dist/packages/_es/CircleProgress.js +1 -1
  21. package/dist/packages/_es/Col.js +1 -1
  22. package/dist/packages/_es/Collapse.js +1 -1
  23. package/dist/packages/_es/CollapseItem.js +1 -1
  24. package/dist/packages/_es/CountDown.js +3 -4
  25. package/dist/packages/_es/CountUp.js +3 -1
  26. package/dist/packages/_es/DatePicker.js +1 -1
  27. package/dist/packages/_es/Dialog.js +1 -1
  28. package/dist/packages/_es/Divider.js +1 -1
  29. package/dist/packages/_es/Drag.js +1 -1
  30. package/dist/packages/_es/Elevator.js +3 -2
  31. package/dist/packages/_es/Empty.js +74 -0
  32. package/dist/packages/_es/FixedNav.js +1 -1
  33. package/dist/packages/_es/Form.js +18 -5
  34. package/dist/packages/_es/FormItem.js +1 -1
  35. package/dist/packages/_es/Grid.js +12 -0
  36. package/dist/packages/_es/GridItem.js +149 -0
  37. package/dist/packages/_es/Icon.js +1 -1
  38. package/dist/packages/_es/ImagePreview.js +104 -10
  39. package/dist/packages/_es/Indicator.js +66 -0
  40. package/dist/packages/_es/InfiniteLoading.js +1 -1
  41. package/dist/packages/_es/Input.js +1 -1
  42. package/dist/packages/_es/InputNumber.js +1 -1
  43. package/dist/packages/_es/Layout.js +1 -1
  44. package/dist/packages/_es/Menu.js +1 -1
  45. package/dist/packages/_es/MenuItem.js +1 -1
  46. package/dist/packages/_es/Navbar.js +1 -1
  47. package/dist/packages/_es/NoticeBar.js +6 -8
  48. package/dist/packages/_es/Notify.js +1 -1
  49. package/dist/packages/_es/NumberKeyboard.js +1 -1
  50. package/dist/packages/_es/OverLay.js +1 -1
  51. package/dist/packages/_es/Pagination.js +1 -1
  52. package/dist/packages/_es/Picker.js +1 -1
  53. package/dist/packages/_es/Popover.js +1 -1
  54. package/dist/packages/_es/Popup.js +1 -1
  55. package/dist/packages/_es/Price.js +1 -1
  56. package/dist/packages/_es/Progress.js +1 -1
  57. package/dist/packages/_es/Radio.js +1 -1
  58. package/dist/packages/_es/RadioGroup.js +1 -1
  59. package/dist/packages/_es/Range.js +1 -1
  60. package/dist/packages/_es/Rate.js +1 -1
  61. package/dist/packages/_es/Row.js +1 -1
  62. package/dist/packages/_es/SearchBar.js +1 -1
  63. package/dist/packages/_es/ShortPassword.js +1 -1
  64. package/dist/packages/_es/Signature.js +1 -1
  65. package/dist/packages/_es/Skeleton.js +138 -0
  66. package/dist/packages/_es/Sku.js +1 -1
  67. package/dist/packages/_es/Step.js +1 -1
  68. package/dist/packages/_es/Steps.js +1 -1
  69. package/dist/packages/_es/Swipe.js +1 -1
  70. package/dist/packages/_es/Swiper.js +1 -1
  71. package/dist/packages/_es/SwiperItem.js +1 -1
  72. package/dist/packages/_es/Switch.js +16 -6
  73. package/dist/packages/_es/TabPane.js +1 -1
  74. package/dist/packages/_es/Tabbar.js +1 -1
  75. package/dist/packages/_es/TabbarItem.js +1 -1
  76. package/dist/packages/_es/Table.js +191 -0
  77. package/dist/packages/_es/Tabs.js +6 -2
  78. package/dist/packages/_es/Tag.js +1 -1
  79. package/dist/packages/_es/TextArea.js +1 -1
  80. package/dist/packages/_es/TimeDetail.js +1 -1
  81. package/dist/packages/_es/TimePannel.js +1 -1
  82. package/dist/packages/_es/TimeSelect.js +1 -1
  83. package/dist/packages/_es/Toast.js +1 -1
  84. package/dist/packages/_es/Uploader.js +1 -1
  85. package/dist/packages/_es/Video.js +1 -1
  86. package/dist/packages/_es/common.js +136 -0
  87. package/dist/packages/_es/component.js +1 -1
  88. package/dist/packages/_es/index.js +1 -1
  89. package/dist/packages/_es/index2.js +1 -1
  90. package/dist/packages/_es/index3.js +1 -1
  91. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  92. package/dist/packages/_es/pxCheck.js +1 -1
  93. package/dist/packages/_es/raf.js +1 -1
  94. package/dist/packages/_es/util.js +1 -1
  95. package/dist/packages/cascader/index.scss +81 -0
  96. package/dist/packages/empty/index.scss +33 -0
  97. package/dist/packages/formitem/index.scss +1 -1
  98. package/dist/packages/grid/index.scss +10 -0
  99. package/dist/packages/griditem/index.scss +92 -0
  100. package/dist/packages/imagepreview/index.scss +1 -0
  101. package/dist/packages/indicator/index.scss +48 -0
  102. package/dist/packages/skeleton/index.scss +57 -0
  103. package/dist/packages/table/index.scss +81 -0
  104. package/dist/packages/tabs/index.scss +16 -0
  105. package/dist/style.css +1 -1
  106. package/dist/styles/themes/default.scss +45 -38
  107. package/dist/styles/variables.scss +49 -0
  108. package/package.json +2 -3
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -152,8 +152,9 @@ const _sfc_main = create({
152
152
  };
153
153
  } else {
154
154
  if (state.animate) {
155
+ let a = ~~(props.height / props.speed / 4);
155
156
  styles = {
156
- transition: `all ${~~(props.height / props.speed / 4)}s`,
157
+ transition: `all ${a == 0 ? ~~(props.height / props.speed) : a}s`,
157
158
  "margin-top": `-${props.height}px`
158
159
  };
159
160
  }
@@ -202,7 +203,7 @@ const _sfc_main = create({
202
203
  };
203
204
  const startRollEasy = () => {
204
205
  showhorseLamp();
205
- state.timer = setInterval(showhorseLamp, ~~(props.height / props.speed / 4) * 1e3 + props.standTime);
206
+ state.timer = setInterval(showhorseLamp, ~~(props.height / props.speed / 4 * 1e3) + props.standTime);
206
207
  };
207
208
  const showhorseLamp = () => {
208
209
  state.animate = true;
@@ -210,7 +211,7 @@ const _sfc_main = create({
210
211
  state.scrollList.push(state.scrollList[0]);
211
212
  state.scrollList.shift();
212
213
  state.animate = false;
213
- }, ~~(props.height / props.speed / 4) * 1e3);
214
+ }, ~~(props.height / props.speed / 4 * 1e3));
214
215
  };
215
216
  const startRoll = () => {
216
217
  state.timer = setInterval(() => {
@@ -314,10 +315,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
314
315
  createElementVNode("view", _hoisted_1, [
315
316
  createElementVNode("view", {
316
317
  ref: "content",
317
- class: normalizeClass(["content", [
318
- _ctx.animationClass,
319
- { "nut-ellipsis": !_ctx.scrollable && !_ctx.wrapable }
320
- ]]),
318
+ class: normalizeClass(["content", [_ctx.animationClass, { "nut-ellipsis": !_ctx.scrollable && !_ctx.wrapable }]]),
321
319
  style: normalizeStyle(_ctx.contentStyle),
322
320
  onAnimationend: _cache[0] || (_cache[0] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args)),
323
321
  onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
19
19
  * (c) 2021 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -0,0 +1,138 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { c as createComponent } from "./component.js";
7
+ import { toRefs, computed, onMounted, resolveComponent, openBlock, createElementBlock, renderSlot, createElementVNode, createBlock, normalizeClass, normalizeStyle, createCommentVNode, Fragment, renderList } from "vue";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const component = {
10
+ props: {
11
+ width: {
12
+ type: String,
13
+ default: "100px"
14
+ },
15
+ height: {
16
+ type: String,
17
+ default: "100px"
18
+ },
19
+ animated: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ avatar: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ avatarShape: {
28
+ type: String,
29
+ default: "round"
30
+ },
31
+ avatarSize: {
32
+ type: String,
33
+ default: "50px"
34
+ },
35
+ loading: {
36
+ type: Boolean,
37
+ default: true
38
+ },
39
+ round: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ row: {
44
+ type: String,
45
+ default: "1"
46
+ },
47
+ title: {
48
+ type: Boolean,
49
+ default: true
50
+ }
51
+ },
52
+ setup(props) {
53
+ const { avatarShape, round, avatarSize } = toRefs(props);
54
+ const avatarClass = computed(() => {
55
+ const prefixCls = "avatarClass";
56
+ return {
57
+ [prefixCls]: true,
58
+ [`${prefixCls}--${avatarShape.value}`]: avatarShape.value
59
+ };
60
+ });
61
+ const blockClass = computed(() => {
62
+ const prefixCls = "blockClass";
63
+ return {
64
+ [prefixCls]: true,
65
+ [`${prefixCls}--round`]: round.value
66
+ };
67
+ });
68
+ const getStyle = () => {
69
+ if (avatarSize == null ? void 0 : avatarSize.value) {
70
+ return {
71
+ width: avatarSize.value,
72
+ height: avatarSize.value
73
+ };
74
+ }
75
+ return {
76
+ width: "50px",
77
+ height: "50px"
78
+ };
79
+ };
80
+ onMounted(() => {
81
+ console.log("row", props.row);
82
+ });
83
+ return {
84
+ avatarShape,
85
+ avatarClass,
86
+ blockClass,
87
+ getStyle
88
+ };
89
+ }
90
+ };
91
+ const { create } = createComponent("skeleton");
92
+ const _sfc_main = create(component);
93
+ const _hoisted_1 = { key: 0 };
94
+ const _hoisted_2 = {
95
+ key: 1,
96
+ class: "skeleton"
97
+ };
98
+ const _hoisted_3 = /* @__PURE__ */ createElementVNode("view", { class: "skeleton-animation" }, null, -1);
99
+ const _hoisted_4 = { class: "content" };
100
+ const _hoisted_5 = { class: "content-line" };
101
+ const _hoisted_6 = {
102
+ key: 0,
103
+ class: "title"
104
+ };
105
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
106
+ const _component_nut_avatar = resolveComponent("nut-avatar");
107
+ return !_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_1, [
108
+ renderSlot(_ctx.$slots, "default")
109
+ ])) : (openBlock(), createElementBlock("view", _hoisted_2, [
110
+ _hoisted_3,
111
+ createElementVNode("view", _hoisted_4, [
112
+ _ctx.avatar ? (openBlock(), createBlock(_component_nut_avatar, {
113
+ key: 0,
114
+ class: normalizeClass(_ctx.avatarClass),
115
+ shape: _ctx.avatarShape,
116
+ style: normalizeStyle(_ctx.getStyle()),
117
+ "bg-color": "rgb(239, 239, 239)"
118
+ }, null, 8, ["class", "shape", "style"])) : createCommentVNode("", true),
119
+ Number(_ctx.row) == 1 ? (openBlock(), createElementBlock("view", {
120
+ key: 1,
121
+ class: normalizeClass(_ctx.blockClass),
122
+ style: normalizeStyle({ width: _ctx.width, height: _ctx.height })
123
+ }, null, 6)) : createCommentVNode("", true),
124
+ createElementVNode("view", _hoisted_5, [
125
+ _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_6)) : createCommentVNode("", true),
126
+ (openBlock(true), createElementBlock(Fragment, null, renderList(Number(_ctx.row), (item, index2) => {
127
+ return openBlock(), createElementBlock("view", {
128
+ key: index2,
129
+ class: normalizeClass(_ctx.blockClass),
130
+ style: normalizeStyle({ width: _ctx.width, height: _ctx.height })
131
+ }, null, 6);
132
+ }), 128))
133
+ ])
134
+ ])
135
+ ]));
136
+ }
137
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
138
+ export { index as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -10,7 +10,7 @@ const { componentName, create } = createComponent("switch");
10
10
  const _sfc_main = create({
11
11
  props: {
12
12
  modelValue: {
13
- type: Boolean,
13
+ type: [String, Number, Boolean],
14
14
  default: false
15
15
  },
16
16
  disable: {
@@ -33,6 +33,14 @@ const _sfc_main = create({
33
33
  type: String,
34
34
  default: ""
35
35
  },
36
+ activeValue: {
37
+ type: [String, Number, Boolean],
38
+ default: true
39
+ },
40
+ inactiveValue: {
41
+ type: [String, Number, Boolean],
42
+ default: false
43
+ },
36
44
  loading: {
37
45
  type: Boolean,
38
46
  default: false
@@ -52,26 +60,28 @@ const _sfc_main = create({
52
60
  },
53
61
  emits: ["change", "update:modelValue"],
54
62
  setup(props, { emit }) {
63
+ const isActive = computed(() => props.modelValue === props.activeValue);
55
64
  const classes = computed(() => {
56
65
  const prefixCls = componentName;
57
66
  return {
58
67
  [prefixCls]: true,
59
- [props.modelValue ? "switch-open" : "switch-close"]: true,
68
+ [isActive.value ? "switch-open" : "switch-close"]: true,
60
69
  [`${prefixCls}-disable`]: props.disable,
61
70
  [`${prefixCls}-base`]: true
62
71
  };
63
72
  });
64
73
  const style = computed(() => {
65
74
  return {
66
- backgroundColor: props.modelValue ? props.activeColor : props.inactiveColor
75
+ backgroundColor: isActive.value ? props.activeColor : props.inactiveColor
67
76
  };
68
77
  });
69
78
  const onClick = (event) => {
70
79
  if (props.disable || props.loading)
71
80
  return;
72
- emit("update:modelValue", !props.modelValue);
81
+ const value = isActive.value ? props.inactiveValue : props.activeValue;
82
+ emit("update:modelValue", value);
73
83
  emit("update:loading");
74
- emit("change", !props.modelValue, event);
84
+ emit("change", value, event);
75
85
  };
76
86
  return {
77
87
  classes,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */