@nutui/nutui 3.1.10 → 3.1.12-beta.1

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 (109) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.d.ts +5 -1
  3. package/dist/nutui.es.js +4041 -3518
  4. package/dist/nutui.umd.js +4084 -3627
  5. package/dist/packages/_es/ActionSheet.js +13 -12
  6. package/dist/packages/_es/Address.js +63 -49
  7. package/dist/packages/_es/Avatar.js +4 -5
  8. package/dist/packages/_es/BackTop.js +72 -109
  9. package/dist/packages/_es/Badge.js +4 -5
  10. package/dist/packages/_es/Barrage.js +63 -57
  11. package/dist/packages/_es/Button.js +5 -6
  12. package/dist/packages/_es/Calendar.js +27 -18
  13. package/dist/packages/_es/Card.js +104 -0
  14. package/dist/packages/_es/Cell.js +5 -13
  15. package/dist/packages/_es/CellGroup.js +4 -5
  16. package/dist/packages/_es/Checkbox.js +3 -3
  17. package/dist/packages/_es/CheckboxGroup.js +9 -4
  18. package/dist/packages/_es/CircleProgress.js +142 -46
  19. package/dist/packages/_es/Col.js +4 -5
  20. package/dist/packages/_es/Collapse.js +35 -10
  21. package/dist/packages/_es/CollapseItem.js +80 -35
  22. package/dist/packages/_es/CountDown.js +7 -5
  23. package/dist/packages/_es/CountUp.js +34 -31
  24. package/dist/packages/_es/DatePicker.js +451 -219
  25. package/dist/packages/_es/Dialog.js +13 -87
  26. package/dist/packages/_es/Divider.js +5 -6
  27. package/dist/packages/_es/Drag.js +76 -50
  28. package/dist/packages/_es/Elevator.js +81 -52
  29. package/dist/packages/_es/FixedNav.js +8 -9
  30. package/dist/packages/_es/Form.js +137 -0
  31. package/dist/packages/_es/FormItem.js +109 -0
  32. package/dist/packages/_es/Icon.js +6 -40
  33. package/dist/packages/_es/ImagePreview.js +23 -21
  34. package/dist/packages/_es/InfiniteLoading.js +95 -109
  35. package/dist/packages/_es/Input.js +22 -21
  36. package/dist/packages/_es/InputNumber.js +24 -18
  37. package/dist/packages/_es/Layout.js +2 -2
  38. package/dist/packages/_es/Menu.js +89 -171
  39. package/dist/packages/_es/MenuItem.js +155 -18
  40. package/dist/packages/_es/Navbar.js +7 -7
  41. package/dist/packages/_es/NoticeBar.js +39 -26
  42. package/dist/packages/_es/Notify.js +30 -166
  43. package/dist/packages/_es/NumberKeyboard.js +10 -6
  44. package/dist/packages/_es/OverLay.js +22 -29
  45. package/dist/packages/_es/Pagination.js +8 -9
  46. package/dist/packages/_es/Picker.js +61 -447
  47. package/dist/packages/_es/Popover.js +146 -25
  48. package/dist/packages/_es/Popup.js +18 -39
  49. package/dist/packages/_es/Price.js +18 -7
  50. package/dist/packages/_es/Progress.js +23 -12
  51. package/dist/packages/_es/Radio.js +20 -7
  52. package/dist/packages/_es/RadioGroup.js +7 -3
  53. package/dist/packages/_es/Range.js +38 -59
  54. package/dist/packages/_es/Rate.js +16 -20
  55. package/dist/packages/_es/Row.js +4 -5
  56. package/dist/packages/_es/SearchBar.js +7 -5
  57. package/dist/packages/_es/ShortPassword.js +89 -59
  58. package/dist/packages/_es/Signature.js +70 -71
  59. package/dist/packages/_es/Sku.js +508 -0
  60. package/dist/packages/_es/Step.js +10 -8
  61. package/dist/packages/_es/Steps.js +2 -2
  62. package/dist/packages/_es/Swipe.js +42 -27
  63. package/dist/packages/_es/Swiper.js +17 -418
  64. package/dist/packages/_es/SwiperItem.js +14 -39
  65. package/dist/packages/_es/Switch.js +4 -5
  66. package/dist/packages/_es/TabPane.js +4 -5
  67. package/dist/packages/_es/Tabbar.js +4 -5
  68. package/dist/packages/_es/TabbarItem.js +8 -9
  69. package/dist/packages/_es/Tabs.js +23 -17
  70. package/dist/packages/_es/Tag.js +5 -6
  71. package/dist/packages/_es/TextArea.js +16 -12
  72. package/dist/packages/_es/TimeDetail.js +7 -5
  73. package/dist/packages/_es/TimePannel.js +7 -5
  74. package/dist/packages/_es/TimeSelect.js +12 -7
  75. package/dist/packages/_es/Toast.js +41 -163
  76. package/dist/packages/_es/Uploader.js +210 -164
  77. package/dist/packages/_es/commonProps.js +30 -0
  78. package/dist/packages/_es/component.js +1 -1
  79. package/dist/packages/_es/index.js +1 -1
  80. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
  81. package/dist/packages/_es/index2.js +44 -8
  82. package/dist/packages/_es/index3.js +419 -0
  83. package/dist/packages/_es/pxCheck.js +1 -1
  84. package/dist/packages/_es/raf.js +1 -1
  85. package/dist/packages/_es/use-lock-scroll.js +23 -0
  86. package/dist/packages/_es/util.js +47 -0
  87. package/dist/packages/button/index.scss +9 -0
  88. package/dist/packages/card/index.scss +97 -0
  89. package/dist/packages/checkbox/index.scss +1 -1
  90. package/dist/packages/form/index.scss +2 -0
  91. package/dist/packages/formitem/index.scss +60 -0
  92. package/dist/packages/menu/index.scss +32 -60
  93. package/dist/packages/menuitem/index.scss +36 -99
  94. package/dist/packages/numberkeyboard/index.scss +1 -1
  95. package/dist/packages/progress/index.scss +2 -0
  96. package/dist/packages/radio/index.scss +32 -4
  97. package/dist/packages/radiogroup/index.scss +20 -0
  98. package/dist/packages/sku/index.scss +147 -0
  99. package/dist/packages/switch/index.scss +1 -1
  100. package/dist/packages/uploader/index.scss +95 -8
  101. package/dist/style.css +1 -1
  102. package/dist/style.es.js +1 -2
  103. package/dist/styles/mixins/index.scss +0 -4
  104. package/dist/styles/themes/default.scss +34 -30
  105. package/dist/styles/variables.scss +45 -3
  106. package/package.json +3 -2
  107. package/dist/packages/_es/Video.js +0 -405
  108. package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
  109. package/dist/packages/_es/style.css +0 -160
@@ -17,17 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __require = typeof require !== "undefined" ? require : (x) => {
21
+ throw new Error('Dynamic require of "' + x + '" is not supported');
22
+ };
20
23
  /*!
21
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 GMT+0800 (中国标准时间)
24
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
22
25
  * (c) 2021 @jdf2e.
23
26
  * Released under the MIT License.
24
27
  */
25
28
  import { c as createComponent } from "./component.js";
26
29
  import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, toDisplayString, createCommentVNode, Fragment, renderList, normalizeStyle, createTextVNode } from "vue";
27
- import { popupProps } from "./Popup.js";
28
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
- import "./OverLay.js";
30
- import "./Icon.js";
30
+ import { p as popupProps } from "./index3.js";
31
+ import "./use-lock-scroll.js";
31
32
  import "./pxCheck.js";
32
33
  const { componentName, create } = createComponent("actionsheet");
33
34
  const _sfc_main = create({
@@ -80,9 +81,9 @@ const _sfc_main = create({
80
81
  emit("cancel");
81
82
  emit("update:visible", false);
82
83
  };
83
- const chooseItem = (item, index2) => {
84
+ const chooseItem = (item, index) => {
84
85
  if (!item.disable) {
85
- emit("choose", item, index2);
86
+ emit("choose", item, index);
86
87
  emit("update:visible", false);
87
88
  }
88
89
  };
@@ -131,12 +132,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
131
132
  _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
132
133
  _ctx.description ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description), 1)) : createCommentVNode("", true),
133
134
  _ctx.menuItems.length ? (openBlock(), createElementBlock("view", _hoisted_4, [
134
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, (item, index2) => {
135
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, (item, index) => {
135
136
  return openBlock(), createElementBlock("view", {
136
137
  class: normalizeClass(["nut-actionsheet-item", { "nut-actionsheet-item-disabled": item.disable }]),
137
138
  style: normalizeStyle({ color: _ctx.isHighlight(item) }),
138
- key: index2,
139
- onClick: ($event) => _ctx.chooseItem(item, index2)
139
+ key: index,
140
+ onClick: ($event) => _ctx.chooseItem(item, index)
140
141
  }, [
141
142
  createTextVNode(toDisplayString(item[_ctx.optionTag]), 1),
142
143
  createElementVNode("view", _hoisted_6, toDisplayString(item[_ctx.optionSubTag]), 1)
@@ -154,5 +155,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
154
155
  }, 8, ["visible", "onClickOverlay"])
155
156
  ], 2);
156
157
  }
157
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
158
- export { index as default };
158
+ _sfc_main.render = _sfc_render;
159
+ export { _sfc_main as default };
@@ -14,16 +14,19 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
+ var __require = typeof require !== "undefined" ? require : (x) => {
18
+ throw new Error('Dynamic require of "' + x + '" is not supported');
19
+ };
17
20
  /*!
18
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
19
22
  * (c) 2021 @jdf2e.
20
23
  * Released under the MIT License.
21
24
  */
22
- import { ref, reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withDirectives, createVNode, vShow, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, createTextVNode, nextTick } from "vue";
25
+ import { computed, ref, reactive, watch, toRefs, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, createCommentVNode, toDisplayString, createElementBlock, Fragment, renderList, normalizeStyle, createTextVNode, createVNode } from "vue";
23
26
  import { c as createComponent } from "./component.js";
24
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
25
- const { componentName, create } = createComponent("address");
26
- const _sfc_main = create({
27
+ import Taro from "@tarojs/taro";
28
+ const { create, componentName } = createComponent("address");
29
+ var _sfc_main = create({
27
30
  inheritAttrs: false,
28
31
  props: {
29
32
  visible: {
@@ -93,6 +96,12 @@ const _sfc_main = create({
93
96
  },
94
97
  emits: ["update:visible", "type", "change", "selected", "close", "close-mask", "switch-module"],
95
98
  setup(props, { emit }) {
99
+ const classes = computed(() => {
100
+ const prefixCls = componentName;
101
+ return {
102
+ [prefixCls]: true
103
+ };
104
+ });
96
105
  const regionLine = ref(null);
97
106
  const tabItemRef = reactive({
98
107
  province: ref(null),
@@ -121,16 +130,16 @@ const _sfc_main = create({
121
130
  return a.title.localeCompare(b.title);
122
131
  });
123
132
  data.forEach((item) => {
124
- const index2 = newData.findIndex((value) => value.title === item.title);
125
- if (index2 <= -1) {
133
+ const index = newData.findIndex((value) => value.title === item.title);
134
+ if (index <= -1) {
126
135
  newData.push({
127
136
  title: item.title,
128
137
  list: [].concat(item)
129
138
  });
130
139
  } else {
131
- newData[index2] = {
140
+ newData[index] = {
132
141
  title: item.title,
133
- list: newData[index2].list.concat(item)
142
+ list: newData[index].list.concat(item)
134
143
  };
135
144
  }
136
145
  });
@@ -151,10 +160,10 @@ const _sfc_main = create({
151
160
  let selectedExistAddress = reactive({});
152
161
  const closeWay = ref("self");
153
162
  const lineDistance = ref(20);
154
- const getTabName = (item, index2) => {
163
+ const getTabName = (item, index) => {
155
164
  if (item.name)
156
165
  return item.name;
157
- if (tabIndex.value < index2) {
166
+ if (tabIndex.value < index) {
158
167
  return item.name;
159
168
  } else {
160
169
  return "\u8BF7\u9009\u62E9";
@@ -170,13 +179,14 @@ const _sfc_main = create({
170
179
  closeWay.value = "mask";
171
180
  };
172
181
  const lineAnimation = () => {
173
- const name = tabItemRef[tabName.value[tabIndex.value]];
174
- nextTick(() => {
175
- if (name) {
176
- const distance = name.offsetLeft;
177
- lineDistance.value = distance ? distance : 20;
178
- }
179
- });
182
+ setTimeout(() => {
183
+ Taro.createSelectorQuery().selectAll(`.${tabName.value[tabIndex.value]}`).boundingClientRect((rects) => {
184
+ rects.forEach((rect) => {
185
+ if (rect.width > 0)
186
+ lineDistance.value = rect.left;
187
+ });
188
+ }).exec();
189
+ }, 100);
180
190
  };
181
191
  const nextAreaList = (item) => {
182
192
  const calBack = {
@@ -198,16 +208,16 @@ const _sfc_main = create({
198
208
  handClose();
199
209
  }
200
210
  };
201
- const changeRegionTab = (item, key, index2) => {
202
- if (getTabName(item, index2)) {
203
- tabIndex.value = index2;
211
+ const changeRegionTab = (item, key, index) => {
212
+ if (getTabName(item, index)) {
213
+ tabIndex.value = index;
204
214
  lineAnimation();
205
215
  }
206
216
  };
207
217
  const selectedExist = (item) => {
208
218
  const copyExistAdd = props.existAddress;
209
219
  let prevExistAdd = {};
210
- copyExistAdd.forEach((list, index2) => {
220
+ copyExistAdd.forEach((list, index) => {
211
221
  if (list && list.selectedAddress) {
212
222
  prevExistAdd = list;
213
223
  }
@@ -293,13 +303,14 @@ const _sfc_main = create({
293
303
  regionList.town = isCustom2.value ? transformData(value) : value;
294
304
  });
295
305
  watch(() => props.existAddress, (value) => {
296
- value.forEach((item, index2) => {
306
+ value.forEach((item, index) => {
297
307
  if (item.selectedAddress) {
298
308
  selectedExistAddress = item;
299
309
  }
300
310
  });
301
311
  });
302
312
  return __spreadValues(__spreadValues({
313
+ classes,
303
314
  showPopup,
304
315
  privateType,
305
316
  tabIndex,
@@ -340,7 +351,10 @@ const _hoisted_10 = {
340
351
  };
341
352
  const _hoisted_11 = { class: "region-tab" };
342
353
  const _hoisted_12 = ["onClick"];
343
- const _hoisted_13 = { class: "elevator-group" };
354
+ const _hoisted_13 = {
355
+ key: 0,
356
+ class: "elevator-group"
357
+ };
344
358
  const _hoisted_14 = {
345
359
  key: 2,
346
360
  class: "exist-address"
@@ -367,7 +381,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
367
381
  onClickOverlay: _ctx.clickOverlay,
368
382
  onOpen: _cache[3] || (_cache[3] = ($event) => _ctx.closeWay = "self"),
369
383
  visible: _ctx.showPopup,
370
- "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => _ctx.showPopup = $event)
384
+ "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => _ctx.showPopup = $event),
385
+ class: normalizeClass(_ctx.classes)
371
386
  }, {
372
387
  default: withCtx(() => [
373
388
  createElementVNode("view", _hoisted_1, [
@@ -376,12 +391,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
376
391
  class: "arrow-back",
377
392
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.switchModule && _ctx.switchModule(...args))
378
393
  }, [
379
- withDirectives(createVNode(_component_nut_icon, {
394
+ _ctx.privateType == "custom" && _ctx.type == "exist" && _ctx.backBtnIcon ? (openBlock(), createBlock(_component_nut_icon, {
395
+ key: 0,
380
396
  name: _ctx.backBtnIcon,
381
397
  color: "#cccccc"
382
- }, null, 8, ["name"]), [
383
- [vShow, _ctx.privateType == "custom" && _ctx.backBtnIcon]
384
- ])
398
+ }, null, 8, ["name"])) : createCommentVNode("", true)
385
399
  ]),
386
400
  createElementVNode("view", _hoisted_3, toDisplayString(_ctx.privateType == "custom" ? _ctx.customAddressTitle : _ctx.existAddressTitle), 1),
387
401
  createElementVNode("view", {
@@ -398,14 +412,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
398
412
  ]),
399
413
  _ctx.privateType == "custom" ? (openBlock(), createElementBlock("view", _hoisted_4, [
400
414
  createElementVNode("view", _hoisted_5, [
401
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
415
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index) => {
402
416
  return openBlock(), createElementBlock("view", {
403
- class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
404
- key: index2,
417
+ class: normalizeClass(["tab-item", [index == _ctx.tabIndex ? "active" : "", key]]),
418
+ key: index,
405
419
  ref: key,
406
- onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
420
+ onClick: ($event) => _ctx.changeRegionTab(item, key, index)
407
421
  }, [
408
- createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
422
+ createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index)), 1)
409
423
  ], 10, _hoisted_6);
410
424
  }), 128)),
411
425
  createElementVNode("view", {
@@ -416,9 +430,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
416
430
  ]),
417
431
  createElementVNode("view", _hoisted_7, [
418
432
  createElementVNode("ul", _hoisted_8, [
419
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.regionList[_ctx.tabName[_ctx.tabIndex]], (item, index2) => {
433
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.regionList[_ctx.tabName[_ctx.tabIndex]], (item, index) => {
420
434
  return openBlock(), createElementBlock("li", {
421
- key: index2,
435
+ key: index,
422
436
  class: normalizeClass(["region-item", [_ctx.selectedRegion[_ctx.tabName[_ctx.tabIndex]].id == item.id ? "active" : ""]]),
423
437
  onClick: ($event) => _ctx.nextAreaList(item)
424
438
  }, [
@@ -435,16 +449,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
435
449
  }), 128))
436
450
  ])
437
451
  ])
438
- ])) : _ctx.privateType == "custom2" ? (openBlock(), createElementBlock("view", _hoisted_10, [
452
+ ])) : _ctx.privateType === "custom2" ? (openBlock(), createElementBlock("view", _hoisted_10, [
439
453
  createElementVNode("view", _hoisted_11, [
440
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
454
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index) => {
441
455
  return openBlock(), createElementBlock("view", {
442
- class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
443
- key: index2,
456
+ class: normalizeClass(["tab-item", [index == _ctx.tabIndex ? "active" : ""]]),
457
+ key: index,
444
458
  ref: key,
445
- onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
459
+ onClick: ($event) => _ctx.changeRegionTab(item, key, index)
446
460
  }, [
447
- createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
461
+ createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index)), 1)
448
462
  ], 10, _hoisted_12);
449
463
  }), 128)),
450
464
  createElementVNode("view", {
@@ -453,20 +467,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
453
467
  style: normalizeStyle({ left: _ctx.lineDistance + "px" })
454
468
  }, null, 4)
455
469
  ]),
456
- createElementVNode("view", _hoisted_13, [
470
+ _ctx.showPopup ? (openBlock(), createElementBlock("view", _hoisted_13, [
457
471
  createVNode(_component_nut_elevator, {
458
472
  height: _ctx.height,
459
473
  "index-list": _ctx.regionList[_ctx.tabName[_ctx.tabIndex]],
460
474
  onClickItem: _ctx.handleElevatorItem
461
475
  }, null, 8, ["height", "index-list", "onClickItem"])
462
- ])
476
+ ])) : createCommentVNode("", true)
463
477
  ])) : _ctx.privateType == "exist" ? (openBlock(), createElementBlock("view", _hoisted_14, [
464
478
  createElementVNode("div", _hoisted_15, [
465
479
  createElementVNode("ul", _hoisted_16, [
466
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.existAddress, (item, index2) => {
480
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.existAddress, (item, index) => {
467
481
  return openBlock(), createElementBlock("li", {
468
482
  class: normalizeClass(["exist-item", [item.selectedAddress ? "active" : ""]]),
469
- key: index2,
483
+ key: index,
470
484
  onClick: ($event) => _ctx.selectedExist(item)
471
485
  }, [
472
486
  createVNode(_component_nut_icon, {
@@ -500,7 +514,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
500
514
  ])
501
515
  ]),
502
516
  _: 1
503
- }, 8, ["onClose", "onClickOverlay", "visible"]);
517
+ }, 8, ["onClose", "onClickOverlay", "visible", "class"]);
504
518
  }
505
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
506
- export { index as default };
519
+ _sfc_main.render = _sfc_render;
520
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { toRefs, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, createVNode, renderSlot, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  const { componentName, create } = createComponent("avatar");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  size: {
13
12
  type: String,
@@ -83,5 +82,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
83
82
  ])) : createCommentVNode("", true)
84
83
  ], 6);
85
84
  }
86
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
87
- export { index as default };
85
+ _sfc_main.render = _sfc_render;
86
+ export { _sfc_main as default };
@@ -1,14 +1,39 @@
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
+ var __require = typeof require !== "undefined" ? require : (x) => {
21
+ throw new Error('Dynamic require of "' + x + '" is not supported');
22
+ };
1
23
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 GMT+0800 (中国标准时间)
24
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
25
  * (c) 2021 @jdf2e.
4
26
  * Released under the MIT License.
5
27
  */
6
- import { reactive, computed, onMounted, onUnmounted, onActivated, onDeactivated, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, withModifiers, renderSlot, createVNode } from "vue";
28
+ import { reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, createVNode, normalizeStyle, withCtx, renderSlot, createElementVNode, normalizeClass, withModifiers } from "vue";
7
29
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
30
  const { componentName, create } = createComponent("backtop");
10
- const _sfc_main = create({
31
+ var _sfc_main = create({
11
32
  props: {
33
+ height: {
34
+ type: String,
35
+ default: "100vh"
36
+ },
12
37
  bottom: {
13
38
  type: Number,
14
39
  default: 20
@@ -17,35 +42,20 @@ const _sfc_main = create({
17
42
  type: Number,
18
43
  default: 10
19
44
  },
20
- elId: {
21
- type: String,
22
- default: ""
23
- },
24
- distance: {
25
- type: Number,
26
- default: 200
27
- },
28
45
  zIndex: {
29
46
  type: Number,
30
47
  default: 10
31
48
  },
32
- isAnimation: {
33
- type: Boolean,
34
- default: true
35
- },
36
- duration: {
49
+ distance: {
37
50
  type: Number,
38
- default: 1e3
51
+ default: 200
39
52
  }
40
53
  },
41
54
  emits: ["click"],
42
55
  setup(props, { emit }) {
43
56
  const state = reactive({
44
57
  backTop: false,
45
- scrollTop: 0,
46
- scrollEl: window,
47
- startTime: 0,
48
- keepAlive: false
58
+ scrollTop: 1
49
59
  });
50
60
  const classes = computed(() => {
51
61
  const prefixCls = componentName;
@@ -61,99 +71,52 @@ const _sfc_main = create({
61
71
  zIndex: props.zIndex
62
72
  };
63
73
  });
64
- function scrollListener() {
65
- if (state.scrollEl instanceof Window) {
66
- state.scrollTop = state.scrollEl.pageYOffset;
67
- } else {
68
- state.scrollTop = state.scrollEl.scrollTop;
69
- }
70
- state.backTop = state.scrollTop >= props.distance;
71
- }
72
- function scroll(y = 0) {
73
- if (state.scrollEl instanceof Window) {
74
- window.scrollTo(0, y);
75
- } else {
76
- state.scrollEl.scrollTop = y;
77
- }
78
- }
79
- function scrollAnimation() {
80
- let cid = requestAniFrame()(function fn() {
81
- var t = props.duration - Math.max(0, state.startTime - +new Date() + props.duration);
82
- var y = t * -state.scrollTop / props.duration + state.scrollTop;
83
- scroll(y);
84
- cid = requestAniFrame()(fn);
85
- if (t == props.duration || y == 0) {
86
- window.cancelAnimationFrame(cid);
87
- }
88
- });
89
- }
90
- function addEventListener() {
91
- state.scrollEl.addEventListener("scroll", scrollListener, false);
92
- state.scrollEl.addEventListener("resize", scrollListener, false);
93
- }
94
- function removeEventListener() {
95
- state.scrollEl.removeEventListener("scroll", scrollListener, false);
96
- state.scrollEl.removeEventListener("resize", scrollListener, false);
97
- }
98
- function initCancelAniFrame() {
99
- window.cancelAnimationFrame = window.webkitCancelAnimationFrame;
100
- }
101
- function requestAniFrame() {
102
- return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
103
- window.setTimeout(callback, 1e3 / 60);
104
- };
105
- }
106
- function click(e) {
107
- state.startTime = +new Date();
108
- props.isAnimation && props.duration > 0 ? scrollAnimation() : scroll();
74
+ const scroll = (e) => {
75
+ state.scrollTop = 2;
76
+ state.backTop = e.detail.scrollTop >= props.distance;
77
+ };
78
+ const click = (e) => {
79
+ state.scrollTop = 1;
109
80
  emit("click", e);
110
- }
111
- function init() {
112
- if (props.elId && document.getElementById(props.elId)) {
113
- state.scrollEl = document.getElementById(props.elId);
114
- }
115
- addEventListener();
116
- initCancelAniFrame();
117
- }
118
- onMounted(() => {
119
- init();
120
- });
121
- onUnmounted(() => {
122
- removeEventListener();
123
- });
124
- onActivated(() => {
125
- if (state.keepAlive) {
126
- state.keepAlive = false;
127
- init();
128
- }
129
- });
130
- onDeactivated(() => {
131
- state.keepAlive = true;
132
- removeEventListener();
133
- });
134
- return {
135
- state,
81
+ };
82
+ return __spreadProps(__spreadValues({}, toRefs(state)), {
136
83
  classes,
137
84
  style,
85
+ scroll,
138
86
  click
139
- };
87
+ });
140
88
  }
141
89
  });
142
90
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
91
+ const _component_scroll_view = resolveComponent("scroll-view");
143
92
  const _component_nut_icon = resolveComponent("nut-icon");
144
- return openBlock(), createElementBlock("div", {
145
- class: normalizeClass(_ctx.classes),
146
- style: normalizeStyle(_ctx.style),
147
- onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.click && _ctx.click(...args), ["stop"]))
148
- }, [
149
- renderSlot(_ctx.$slots, "default", {}, () => [
150
- createVNode(_component_nut_icon, {
151
- size: "19px",
152
- class: "nut-backtop-main",
153
- name: "top"
154
- })
155
- ])
156
- ], 6);
93
+ return openBlock(), createElementBlock("view", null, [
94
+ createVNode(_component_scroll_view, {
95
+ "scroll-y": true,
96
+ style: normalizeStyle({ height: _ctx.height }),
97
+ onScroll: _ctx.scroll,
98
+ "scroll-top": _ctx.scrollTop,
99
+ "scroll-with-animation": "true"
100
+ }, {
101
+ default: withCtx(() => [
102
+ renderSlot(_ctx.$slots, "content")
103
+ ]),
104
+ _: 3
105
+ }, 8, ["style", "onScroll", "scroll-top"]),
106
+ createElementVNode("view", {
107
+ class: normalizeClass(_ctx.classes),
108
+ style: normalizeStyle(_ctx.style),
109
+ onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.click && _ctx.click(...args), ["stop"]))
110
+ }, [
111
+ renderSlot(_ctx.$slots, "icon", {}, () => [
112
+ createVNode(_component_nut_icon, {
113
+ size: "19px",
114
+ class: "nut-backtop-main",
115
+ name: "top"
116
+ })
117
+ ])
118
+ ], 6)
119
+ ]);
157
120
  }
158
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
159
- export { index as default };
121
+ _sfc_main.render = _sfc_render;
122
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { reactive, computed, openBlock, createElementBlock, createElementVNode, renderSlot, withDirectives, toDisplayString, normalizeClass, normalizeStyle, vShow } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  const { create } = createComponent("badge");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  value: {
13
12
  type: [String, Number]
@@ -86,5 +85,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
86
85
  ])
87
86
  ]);
88
87
  }
89
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
90
- export { index as default };
88
+ _sfc_main.render = _sfc_render;
89
+ export { _sfc_main as default };