@nutui/nutui 3.1.19-beta.0 → 3.1.19-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 (110) hide show
  1. package/dist/nutui.d.ts +38 -37
  2. package/dist/nutui.es.js +13439 -12616
  3. package/dist/nutui.umd.js +13431 -12695
  4. package/dist/packages/_es/ActionSheet.js +12 -18
  5. package/dist/packages/_es/Address.js +78 -69
  6. package/dist/packages/_es/Audio.js +12 -12
  7. package/dist/packages/_es/AudioOperate.js +1 -1
  8. package/dist/packages/_es/Avatar.js +3 -3
  9. package/dist/packages/_es/BackTop.js +68 -110
  10. package/dist/packages/_es/Badge.js +3 -3
  11. package/dist/packages/_es/Barrage.js +62 -55
  12. package/dist/packages/_es/Button.js +2 -2
  13. package/dist/packages/_es/Calendar.js +28 -23
  14. package/dist/packages/_es/CalendarItem.js +3 -3
  15. package/dist/packages/_es/Card.js +6 -5
  16. package/dist/packages/_es/Cascader.js +7 -7
  17. package/dist/packages/_es/Cell.js +4 -11
  18. package/dist/packages/_es/CellGroup.js +1 -1
  19. package/dist/packages/_es/Checkbox.js +1 -1
  20. package/dist/packages/_es/CheckboxGroup.js +1 -1
  21. package/dist/packages/_es/CircleProgress.js +149 -40
  22. package/dist/packages/_es/Col.js +1 -1
  23. package/dist/packages/_es/Collapse.js +34 -8
  24. package/dist/packages/_es/CollapseItem.js +90 -59
  25. package/dist/packages/_es/CountDown.js +5 -5
  26. package/dist/packages/_es/CountUp.js +43 -51
  27. package/dist/packages/_es/DatePicker.js +21 -20
  28. package/dist/packages/_es/Dialog.js +8 -86
  29. package/dist/packages/_es/Divider.js +4 -4
  30. package/dist/packages/_es/Drag.js +92 -54
  31. package/dist/packages/_es/Elevator.js +74 -49
  32. package/dist/packages/_es/Empty.js +3 -3
  33. package/dist/packages/_es/FixedNav.js +5 -5
  34. package/dist/packages/_es/Form.js +4 -4
  35. package/dist/packages/_es/FormItem.js +1 -1
  36. package/dist/packages/_es/Grid.js +1 -1
  37. package/dist/packages/_es/GridItem.js +8 -26
  38. package/dist/packages/_es/Icon.js +1 -1
  39. package/dist/packages/_es/ImagePreview.js +15 -84
  40. package/dist/packages/_es/Indicator.js +3 -3
  41. package/dist/packages/_es/InfiniteLoading.js +93 -107
  42. package/dist/packages/_es/Input.js +8 -8
  43. package/dist/packages/_es/InputNumber.js +23 -16
  44. package/dist/packages/_es/Layout.js +1 -1
  45. package/dist/packages/_es/List.js +41 -34
  46. package/dist/packages/_es/Menu.js +15 -12
  47. package/dist/packages/_es/MenuItem.js +9 -9
  48. package/dist/packages/_es/Navbar.js +3 -4
  49. package/dist/packages/_es/NoticeBar.js +47 -40
  50. package/dist/packages/_es/Notify.js +29 -168
  51. package/dist/packages/_es/NumberKeyboard.js +5 -10
  52. package/dist/packages/_es/OldPicker.js +122 -120
  53. package/dist/packages/_es/OverLay.js +5 -25
  54. package/dist/packages/_es/Pagination.js +7 -7
  55. package/dist/packages/_es/Picker.js +39 -16
  56. package/dist/packages/_es/Popover.js +155 -30
  57. package/dist/packages/_es/Popup.js +8 -71
  58. package/dist/packages/_es/Price.js +17 -5
  59. package/dist/packages/_es/Progress.js +18 -8
  60. package/dist/packages/_es/PullRefresh.js +1 -1
  61. package/dist/packages/_es/Radio.js +2 -2
  62. package/dist/packages/_es/RadioGroup.js +1 -1
  63. package/dist/packages/_es/Range.js +46 -33
  64. package/dist/packages/_es/Rate.js +16 -19
  65. package/dist/packages/_es/Row.js +1 -1
  66. package/dist/packages/_es/SearchBar.js +8 -6
  67. package/dist/packages/_es/ShortPassword.js +89 -67
  68. package/dist/packages/_es/SideNavBar.js +5 -16
  69. package/dist/packages/_es/SideNavBarItem.js +1 -1
  70. package/dist/packages/_es/Signature.js +69 -88
  71. package/dist/packages/_es/Skeleton.js +8 -11
  72. package/dist/packages/_es/Sku.js +47 -56
  73. package/dist/packages/_es/Step.js +1 -1
  74. package/dist/packages/_es/Steps.js +1 -1
  75. package/dist/packages/_es/Sticky.js +28 -23
  76. package/dist/packages/_es/SubSideNavBar.js +1 -1
  77. package/dist/packages/_es/Swipe.js +39 -26
  78. package/dist/packages/_es/Swiper.js +31 -13
  79. package/dist/packages/_es/SwiperItem.js +1 -1
  80. package/dist/packages/_es/Switch.js +3 -3
  81. package/dist/packages/_es/TabPane.js +1 -1
  82. package/dist/packages/_es/Tabbar.js +3 -3
  83. package/dist/packages/_es/TabbarItem.js +17 -23
  84. package/dist/packages/_es/Table.js +13 -13
  85. package/dist/packages/_es/Tabs.js +21 -20
  86. package/dist/packages/_es/Tag.js +4 -4
  87. package/dist/packages/_es/TextArea.js +44 -42
  88. package/dist/packages/_es/TimeDetail.js +4 -3
  89. package/dist/packages/_es/TimePannel.js +3 -3
  90. package/dist/packages/_es/TimeSelect.js +8 -7
  91. package/dist/packages/_es/Toast.js +41 -170
  92. package/dist/packages/_es/Uploader.js +109 -138
  93. package/dist/packages/_es/Video.js +3 -3
  94. package/dist/packages/_es/common.js +1 -1
  95. package/dist/packages/_es/component.js +1 -1
  96. package/dist/packages/_es/index.js +44 -6
  97. package/dist/packages/_es/{index5.js → index.taro.js} +127 -95
  98. package/dist/packages/_es/index2.js +1 -1
  99. package/dist/packages/_es/index3.js +56 -28
  100. package/dist/packages/_es/index4.js +413 -56
  101. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  102. package/dist/packages/_es/pxCheck.js +1 -1
  103. package/dist/packages/_es/use-lock-scroll.js +23 -0
  104. package/dist/packages/_es/util.js +1 -1
  105. package/dist/packages/uploader/index.scss +2 -2
  106. package/dist/style.css +1 -1
  107. package/dist/styles/themes/default.scss +61 -61
  108. package/dist/styles/themes/jdt.scss +61 -61
  109. package/package.json +1 -1
  110. package/dist/packages/_es/raf.js +0 -19
@@ -18,19 +18,20 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
22
  * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { ref, reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from "vue";
25
+ import { ref, reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, normalizeClass, normalizeStyle, withCtx, createElementVNode, createElementBlock, Fragment, renderList, renderSlot } from "vue";
26
26
  import { c as createComponent } from "./component.js";
27
+ import Taro from "@tarojs/taro";
27
28
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
29
  const { componentName, create } = createComponent("list");
29
30
  const _sfc_main = create({
30
31
  props: {
31
32
  height: {
32
33
  type: [Number],
33
- default: 50
34
+ default: 0
34
35
  },
35
36
  listData: {
36
37
  type: Array,
@@ -43,7 +44,7 @@ const _sfc_main = create({
43
44
  setup(props, { emit }) {
44
45
  const list = ref(null);
45
46
  const state = reactive({
46
- screenHeight: document.documentElement.clientHeight || document.body.clientHeight || 667,
47
+ screenHeight: Taro.getSystemInfoSync().windowHeight,
47
48
  startOffset: 0,
48
49
  start: 0,
49
50
  list: props.listData.slice()
@@ -69,9 +70,8 @@ const _sfc_main = create({
69
70
  const visibleData = computed(() => {
70
71
  return state.list.slice(state.start, Math.min(end.value, state.list.length));
71
72
  });
72
- const handleScrollEvent = () => {
73
- var _a;
74
- const scrollTop = (_a = list.value) == null ? void 0 : _a.scrollTop;
73
+ const handleScrollEvent = async (e) => {
74
+ const scrollTop = e.detail.scrollTop;
75
75
  state.start = Math.floor(scrollTop / props.height);
76
76
  if (end.value > state.list.length) {
77
77
  emit("scroll");
@@ -92,33 +92,40 @@ const _sfc_main = create({
92
92
  }
93
93
  });
94
94
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
95
- return openBlock(), createElementBlock("view", {
95
+ const _component_scroll_view = resolveComponent("scroll-view");
96
+ return openBlock(), createBlock(_component_scroll_view, {
96
97
  class: normalizeClass(_ctx.classes),
97
- onScrollPassive: _cache[0] || (_cache[0] = (...args) => _ctx.handleScrollEvent && _ctx.handleScrollEvent(...args)),
98
+ "scroll-y": true,
99
+ style: normalizeStyle({ height: _ctx.screenHeight + "px" }),
100
+ "scroll-top": "0",
101
+ onScroll: _ctx.handleScrollEvent,
98
102
  ref: "list"
99
- }, [
100
- createElementVNode("div", {
101
- class: "nut-list-phantom",
102
- style: normalizeStyle({ height: _ctx.listHeight + "px" })
103
- }, null, 4),
104
- createElementVNode("div", {
105
- class: "nut-list-container",
106
- style: normalizeStyle({ transform: _ctx.getTransform })
107
- }, [
108
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index2) => {
109
- return openBlock(), createElementBlock("div", {
110
- class: "nut-list-item",
111
- style: normalizeStyle({ height: _ctx.height + "px" }),
112
- key: item
113
- }, [
114
- renderSlot(_ctx.$slots, "default", {
115
- item,
116
- index: index2
117
- })
118
- ], 4);
119
- }), 128))
120
- ], 4)
121
- ], 34);
103
+ }, {
104
+ default: withCtx(() => [
105
+ createElementVNode("div", {
106
+ class: "nut-list-phantom",
107
+ style: normalizeStyle({ height: _ctx.listHeight + "px" })
108
+ }, null, 4),
109
+ createElementVNode("div", {
110
+ class: "nut-list-container",
111
+ style: normalizeStyle({ transform: _ctx.getTransform })
112
+ }, [
113
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index) => {
114
+ return openBlock(), createElementBlock("div", {
115
+ class: "nut-list-item",
116
+ style: normalizeStyle({ height: _ctx.height + "px" }),
117
+ key: item
118
+ }, [
119
+ renderSlot(_ctx.$slots, "default", {
120
+ item,
121
+ index
122
+ })
123
+ ], 4);
124
+ }), 128))
125
+ ], 4)
126
+ ]),
127
+ _: 3
128
+ }, 8, ["class", "style", "onScroll"]);
122
129
  }
123
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
124
- export { index as default };
130
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
131
+ export { index_taro as default };
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { ref, computed, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, createVNode, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { u as useRect } from "./index3.js";
8
+ import Taro from "@tarojs/taro";
9
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  const { componentName, create } = createComponent("menu");
11
11
  const _sfc_main = create({
@@ -20,7 +20,7 @@ const _sfc_main = create({
20
20
  },
21
21
  duration: {
22
22
  type: [Number, String],
23
- default: 0
23
+ default: 0.3
24
24
  }
25
25
  },
26
26
  setup(props, { emit, slots }) {
@@ -57,14 +57,17 @@ const _sfc_main = create({
57
57
  });
58
58
  const updateOffset = () => {
59
59
  if (barRef.value) {
60
- const rect = useRect(barRef);
61
- offset.value = rect.bottom;
60
+ setTimeout(() => {
61
+ Taro.createSelectorQuery().select(".nut-menu__bar.opened").boundingClientRect((rect) => {
62
+ offset.value = rect.bottom;
63
+ }).exec();
64
+ }, 100);
62
65
  }
63
66
  };
64
67
  linkChildren({ props, offset });
65
68
  const toggleItem = (active) => {
66
- children.forEach((item, index2) => {
67
- if (index2 === active) {
69
+ children.forEach((item, index) => {
70
+ if (index === active) {
68
71
  updateOffset();
69
72
  item.toggle();
70
73
  } else if (item.state.showPopup) {
@@ -92,11 +95,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
95
  class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
93
96
  ref: "barRef"
94
97
  }, [
95
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
98
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index) => {
96
99
  return openBlock(), createElementBlock("view", {
97
- key: index2,
100
+ key: index,
98
101
  class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
99
- onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
102
+ onClick: ($event) => !item.disabled && _ctx.toggleItem(index),
100
103
  style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
101
104
  }, [
102
105
  createElementVNode("view", {
@@ -115,5 +118,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
115
118
  renderSlot(_ctx.$slots, "default")
116
119
  ], 2);
117
120
  }
118
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
119
- export { index as default };
121
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
122
+ export { index_taro as default };
@@ -1,14 +1,15 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { reactive, computed, inject, getCurrentInstance, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createCommentVNode, toDisplayString, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
8
  import _sfc_main$1 from "./Icon.js";
9
- import popup from "./Popup.js";
9
+ import Popup from "./Popup.js";
10
10
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
11
11
  import "./pxCheck.js";
12
+ import "./use-lock-scroll.js";
12
13
  import "./OverLay.js";
13
14
  const { componentName, create } = createComponent("menu-item");
14
15
  const _sfc_main = create({
@@ -34,7 +35,7 @@ const _sfc_main = create({
34
35
  },
35
36
  components: {
36
37
  [_sfc_main$1.name]: _sfc_main$1,
37
- [popup.name]: popup
38
+ [Popup.name]: Popup
38
39
  },
39
40
  emits: ["update:modelValue", "change"],
40
41
  setup(props, { emit, slots }) {
@@ -133,14 +134,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
133
134
  "pop-class": "nut-menu__pop",
134
135
  overlayClass: "nut-menu__overlay",
135
136
  overlay: _ctx.parent.props.overlay,
136
- onClosed: _ctx.handleClose,
137
- isWrapTeleport: false
137
+ onClosed: _ctx.handleClose
138
138
  }), {
139
139
  default: withCtx(() => [
140
140
  createElementVNode("view", _hoisted_1, [
141
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index2) => {
141
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
142
142
  return openBlock(), createElementBlock("view", {
143
- key: index2,
143
+ key: index,
144
144
  class: normalizeClass(["nut-menu-item__option", { active: option.value === _ctx.modelValue }]),
145
145
  style: normalizeStyle({ "flex-basis": 100 / _ctx.cols + "%" }),
146
146
  onClick: ($event) => _ctx.onClick(option)
@@ -164,5 +164,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
164
164
  [vShow, _ctx.state.showWrapper]
165
165
  ]);
166
166
  }
167
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
168
- export { index as default };
167
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
168
+ export { index_taro as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -74,7 +74,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
74
74
  createElementVNode("view", _hoisted_2, [
75
75
  _ctx.title ? (openBlock(), createElementBlock("view", {
76
76
  key: 0,
77
- class: "title",
78
77
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCenter && _ctx.handleCenter(...args))
79
78
  }, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
80
79
  _ctx.titIcon ? (openBlock(), createBlock(_component_nut_icon, {
@@ -95,5 +94,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
95
94
  ])
96
95
  ], 2);
97
96
  }
98
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
99
- export { index as default };
97
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
98
+ export { index_taro as default };
@@ -18,12 +18,13 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
22
  * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
25
  import { h, ref, reactive, computed, watch, onMounted, onActivated, onDeactivated, onUnmounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, withDirectives, normalizeStyle, renderSlot, createBlock, createCommentVNode, createElementVNode, createTextVNode, toDisplayString, withModifiers, createVNode, vShow, Fragment, renderList } from "vue";
26
26
  import { c as createComponent } from "./component.js";
27
+ import Taro from "@tarojs/taro";
27
28
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
29
  const { componentName, create } = createComponent("noticebar");
29
30
  const _sfc_main = create({
@@ -66,7 +67,7 @@ const _sfc_main = create({
66
67
  rightIcon: { type: String, default: "" },
67
68
  color: {
68
69
  type: String,
69
- default: ""
70
+ default: "#F9911B"
70
71
  },
71
72
  background: {
72
73
  type: String,
@@ -88,7 +89,6 @@ const _sfc_main = create({
88
89
  components: {
89
90
  ScrollItem: function(props) {
90
91
  props.item.props.style = props.style;
91
- props.item.key = props.key;
92
92
  return h(props.item);
93
93
  }
94
94
  },
@@ -108,7 +108,8 @@ const _sfc_main = create({
108
108
  distance: 0,
109
109
  timer: null,
110
110
  keepAlive: false,
111
- isCanScroll: null
111
+ isCanScroll: null,
112
+ id: Math.round(Math.random() * 1e5)
112
113
  });
113
114
  const classes = computed(() => {
114
115
  const prefixCls = componentName;
@@ -118,7 +119,7 @@ const _sfc_main = create({
118
119
  });
119
120
  const isEllipsis = computed(() => {
120
121
  if (state.isCanScroll == null) {
121
- return props.wrapable;
122
+ return false;
122
123
  } else {
123
124
  return !state.isCanScroll && !props.wrapable;
124
125
  }
@@ -131,9 +132,10 @@ const _sfc_main = create({
131
132
  }
132
133
  });
133
134
  const barStyle = computed(() => {
134
- let style = {};
135
- props.color && (style.color = props.color);
136
- props.background && (style.background = props.background);
135
+ let style = {
136
+ color: props.color,
137
+ background: props.background
138
+ };
137
139
  if (props.direction == "vertical") {
138
140
  style.height = `${props.height}px`;
139
141
  }
@@ -161,9 +163,8 @@ const _sfc_main = create({
161
163
  };
162
164
  } else {
163
165
  if (state.animate) {
164
- let a = ~~(props.height / props.speed / 4);
165
166
  styles = {
166
- transition: `all ${a == 0 ? ~~(props.height / props.speed) : a}s`,
167
+ transition: `all ${~~(props.height / props.speed / 4)}s`,
167
168
  "margin-top": `-${props.height}px`
168
169
  };
169
170
  }
@@ -184,19 +185,26 @@ const _sfc_main = create({
184
185
  if (!wrap.value || !content.value) {
185
186
  return;
186
187
  }
187
- const wrapWidth = wrap.value.getBoundingClientRect().width;
188
- const offsetWidth = content.value.getBoundingClientRect().width;
189
- state.isCanScroll = props.scrollable == null ? offsetWidth > wrapWidth : props.scrollable;
190
- console.log(111, state.isCanScroll);
191
- if (state.isCanScroll) {
192
- state.wrapWidth = wrapWidth;
193
- state.offsetWidth = offsetWidth;
194
- state.duration = offsetWidth / props.speed;
195
- state.animationClass = "play";
196
- } else {
197
- state.animationClass = "";
198
- }
199
- }, 0);
188
+ let wrapWidth = 0;
189
+ let offsetWidth = 0;
190
+ Taro.createSelectorQuery().select(`.wrap${state.id}`).boundingClientRect((rect) => {
191
+ if (rect.width > 0)
192
+ wrapWidth = rect.width;
193
+ }).exec();
194
+ Taro.createSelectorQuery().select(`.content${state.id}`).boundingClientRect((rect) => {
195
+ if (rect.width > 0)
196
+ offsetWidth = rect.width;
197
+ state.isCanScroll = props.scrollable == null ? offsetWidth > wrapWidth : props.scrollable;
198
+ if (state.isCanScroll) {
199
+ state.wrapWidth = wrapWidth;
200
+ state.offsetWidth = offsetWidth;
201
+ state.duration = offsetWidth / props.speed;
202
+ state.animationClass = "play";
203
+ } else {
204
+ state.animationClass = "";
205
+ }
206
+ }).exec();
207
+ }, 100);
200
208
  };
201
209
  const handleClick = (event) => {
202
210
  emit("click", event);
@@ -216,7 +224,7 @@ const _sfc_main = create({
216
224
  };
217
225
  const startRollEasy = () => {
218
226
  showhorseLamp();
219
- state.timer = setInterval(showhorseLamp, ~~(props.height / props.speed / 4 * 1e3) + props.standTime);
227
+ state.timer = setInterval(showhorseLamp, ~~(props.height / props.speed / 4) * 1e3 + props.standTime);
220
228
  };
221
229
  const showhorseLamp = () => {
222
230
  state.animate = true;
@@ -224,7 +232,7 @@ const _sfc_main = create({
224
232
  state.scrollList.push(state.scrollList[0]);
225
233
  state.scrollList.shift();
226
234
  state.animate = false;
227
- }, ~~(props.height / props.speed / 4 * 1e3));
235
+ }, ~~(props.height / props.speed / 4) * 1e3);
228
236
  };
229
237
  const startRoll = () => {
230
238
  state.timer = setInterval(() => {
@@ -295,11 +303,7 @@ const _sfc_main = create({
295
303
  });
296
304
  }
297
305
  });
298
- const _hoisted_1 = {
299
- ref: "wrap",
300
- class: "wrap"
301
- };
302
- const _hoisted_2 = ["onClick"];
306
+ const _hoisted_1 = ["onClick"];
303
307
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
304
308
  const _component_nut_icon = resolveComponent("nut-icon");
305
309
  const _component_ScrollItem = resolveComponent("ScrollItem");
@@ -326,10 +330,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
326
330
  }, null, 8, ["color"])) : createCommentVNode("", true)
327
331
  ])
328
332
  ], 4)) : createCommentVNode("", true),
329
- createElementVNode("view", _hoisted_1, [
333
+ createElementVNode("view", {
334
+ ref: "wrap",
335
+ class: normalizeClass(`wrap wrap${_ctx.id}`)
336
+ }, [
330
337
  createElementVNode("view", {
331
338
  ref: "content",
332
- class: normalizeClass(["content", _ctx.animationClass, { "nut-ellipsis": _ctx.isEllipsis }]),
339
+ class: normalizeClass(["content", [_ctx.animationClass, { "nut-ellipsis": _ctx.isEllipsis }, `content${_ctx.id}`]]),
333
340
  style: normalizeStyle(_ctx.contentStyle),
334
341
  onAnimationend: _cache[0] || (_cache[0] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args)),
335
342
  onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
@@ -338,7 +345,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
338
345
  createTextVNode(toDisplayString(_ctx.text), 1)
339
346
  ])
340
347
  ], 38)
341
- ], 512),
348
+ ], 2),
342
349
  _ctx.closeMode || _ctx.rightIcon ? (openBlock(), createElementBlock("view", {
343
350
  key: 1,
344
351
  class: "right-icon",
@@ -364,9 +371,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
364
371
  class: "horseLamp_list",
365
372
  style: normalizeStyle(_ctx.horseLampStyle)
366
373
  }, [
367
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
374
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index) => {
368
375
  return openBlock(), createBlock(_component_ScrollItem, {
369
- key: index2,
376
+ key: index,
370
377
  style: normalizeStyle({ height: _ctx.height + "px", "line-height": _ctx.height + "px" }),
371
378
  item
372
379
  }, null, 8, ["style", "item"]);
@@ -376,13 +383,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
376
383
  class: "horseLamp_list",
377
384
  style: normalizeStyle(_ctx.horseLampStyle)
378
385
  }, [
379
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
386
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index) => {
380
387
  return openBlock(), createElementBlock("li", {
381
388
  class: "horseLamp_list_item",
382
- key: index2,
389
+ key: index,
383
390
  style: normalizeStyle({ height: _ctx.height }),
384
391
  onClick: ($event) => _ctx.go(item)
385
- }, toDisplayString(item), 13, _hoisted_2);
392
+ }, toDisplayString(item), 13, _hoisted_1);
386
393
  }), 128))
387
394
  ], 4)),
388
395
  createElementVNode("view", {
@@ -399,5 +406,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
399
406
  ], 4)) : createCommentVNode("", true)
400
407
  ], 2);
401
408
  }
402
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
403
- export { index as default };
409
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
410
+ export { index_taro as default };