@nutui/nutui 3.1.18-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.
- package/CHANGELOG.md +41 -0
- package/LICENSE +1 -1
- package/README.md +6 -0
- package/dist/nutui.d.ts +39 -36
- package/dist/nutui.es.js +13149 -11288
- package/dist/nutui.umd.js +13156 -11381
- package/dist/packages/_es/ActionSheet.js +13 -19
- package/dist/packages/_es/Address.js +70 -55
- package/dist/packages/_es/Audio.js +13 -13
- package/dist/packages/_es/AudioOperate.js +125 -0
- package/dist/packages/_es/Avatar.js +4 -4
- package/dist/packages/_es/BackTop.js +69 -108
- package/dist/packages/_es/Badge.js +4 -4
- package/dist/packages/_es/Barrage.js +63 -56
- package/dist/packages/_es/Button.js +3 -3
- package/dist/packages/_es/Calendar.js +30 -702
- package/dist/packages/_es/CalendarItem.js +10 -0
- package/dist/packages/_es/Card.js +7 -6
- package/dist/packages/_es/Cascader.js +8 -8
- package/dist/packages/_es/Cell.js +27 -27
- package/dist/packages/_es/CellGroup.js +2 -2
- package/dist/packages/_es/Checkbox.js +4 -4
- package/dist/packages/_es/CheckboxGroup.js +3 -3
- package/dist/packages/_es/CircleProgress.js +150 -41
- package/dist/packages/_es/Col.js +2 -2
- package/dist/packages/_es/Collapse.js +35 -9
- package/dist/packages/_es/CollapseItem.js +79 -38
- package/dist/packages/_es/CountDown.js +8 -6
- package/dist/packages/_es/CountUp.js +31 -30
- package/dist/packages/_es/DatePicker.js +81 -44
- package/dist/packages/_es/Dialog.js +7 -83
- package/dist/packages/_es/Divider.js +5 -5
- package/dist/packages/_es/Drag.js +93 -55
- package/dist/packages/_es/Elevator.js +75 -50
- package/dist/packages/_es/Empty.js +4 -4
- package/dist/packages/_es/FixedNav.js +6 -6
- package/dist/packages/_es/Form.js +11 -9
- package/dist/packages/_es/FormItem.js +9 -6
- package/dist/packages/_es/Grid.js +2 -2
- package/dist/packages/_es/GridItem.js +9 -27
- package/dist/packages/_es/Icon.js +2 -2
- package/dist/packages/_es/ImagePreview.js +14 -83
- package/dist/packages/_es/Indicator.js +4 -4
- package/dist/packages/_es/InfiniteLoading.js +94 -108
- package/dist/packages/_es/Input.js +297 -73
- package/dist/packages/_es/InputNumber.js +24 -17
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/List.js +131 -0
- package/dist/packages/_es/Menu.js +16 -13
- package/dist/packages/_es/MenuItem.js +8 -8
- package/dist/packages/_es/Navbar.js +17 -12
- package/dist/packages/_es/NoticeBar.js +47 -39
- package/dist/packages/_es/Notify.js +28 -163
- package/dist/packages/_es/NumberKeyboard.js +4 -4
- package/dist/packages/_es/OldPicker.js +486 -0
- package/dist/packages/_es/OverLay.js +6 -26
- package/dist/packages/_es/Pagination.js +8 -8
- package/dist/packages/_es/Picker.js +192 -163
- package/dist/packages/_es/Popover.js +155 -30
- package/dist/packages/_es/Popup.js +7 -70
- package/dist/packages/_es/Price.js +18 -6
- package/dist/packages/_es/Progress.js +29 -27
- package/dist/packages/_es/PullRefresh.js +363 -0
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +169 -46
- package/dist/packages/_es/Rate.js +17 -20
- package/dist/packages/_es/Row.js +2 -2
- package/dist/packages/_es/SearchBar.js +9 -7
- package/dist/packages/_es/ShortPassword.js +90 -68
- package/dist/packages/_es/SideNavBar.js +6 -17
- package/dist/packages/_es/SideNavBarItem.js +2 -2
- package/dist/packages/_es/Signature.js +70 -70
- package/dist/packages/_es/Skeleton.js +9 -12
- package/dist/packages/_es/Sku.js +40 -31
- package/dist/packages/_es/Step.js +28 -12
- package/dist/packages/_es/Steps.js +8 -3
- package/dist/packages/_es/Sticky.js +29 -24
- package/dist/packages/_es/SubSideNavBar.js +2 -2
- package/dist/packages/_es/Swipe.js +40 -27
- package/dist/packages/_es/Swiper.js +32 -14
- package/dist/packages/_es/SwiperItem.js +2 -2
- package/dist/packages/_es/Switch.js +4 -4
- package/dist/packages/_es/TabPane.js +2 -2
- package/dist/packages/_es/Tabbar.js +4 -4
- package/dist/packages/_es/TabbarItem.js +28 -23
- package/dist/packages/_es/Table.js +14 -14
- package/dist/packages/_es/Tabs.js +19 -15
- package/dist/packages/_es/Tag.js +14 -8
- package/dist/packages/_es/TextArea.js +49 -15
- package/dist/packages/_es/TimeDetail.js +5 -4
- package/dist/packages/_es/TimePannel.js +4 -4
- package/dist/packages/_es/TimeSelect.js +9 -8
- package/dist/packages/_es/Toast.js +42 -171
- package/dist/packages/_es/Uploader.js +108 -139
- package/dist/packages/_es/Video.js +14 -10
- package/dist/packages/_es/common.js +2 -2
- package/dist/packages/_es/component.js +2 -2
- package/dist/packages/_es/index.js +45 -7
- package/dist/packages/_es/index.taro.js +719 -0
- package/dist/packages/_es/index2.js +2 -2
- package/dist/packages/_es/index3.js +57 -29
- package/dist/packages/_es/index4.js +414 -57
- package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
- package/dist/packages/_es/pxCheck.js +2 -2
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +2 -2
- package/dist/packages/badge/index.scss +11 -13
- package/dist/packages/button/index.scss +1 -0
- package/dist/packages/calendar/index.scss +9 -4
- package/dist/packages/calendaritem/index.scss +0 -207
- package/dist/packages/cell/index.scss +6 -6
- package/dist/packages/checkbox/index.scss +4 -3
- package/dist/packages/collapseitem/index.scss +21 -11
- package/dist/packages/countdown/index.scss +3 -1
- package/dist/packages/divider/index.scss +8 -8
- package/dist/packages/elevator/index.scss +36 -36
- package/dist/packages/formitem/index.scss +15 -8
- package/dist/packages/indicator/index.scss +1 -1
- package/dist/packages/input/index.scss +70 -24
- package/dist/packages/inputnumber/index.scss +4 -2
- package/dist/packages/list/index.scss +24 -0
- package/dist/packages/menu/index.scss +3 -3
- package/dist/packages/navbar/index.scss +28 -8
- package/dist/packages/noticebar/index.scss +7 -8
- package/dist/packages/notify/index.scss +9 -0
- package/dist/packages/numberkeyboard/index.scss +22 -21
- package/dist/packages/oldpicker/index.scss +131 -0
- package/dist/packages/picker/index.scss +38 -32
- package/dist/packages/progress/index.scss +6 -5
- package/dist/packages/radio/index.scss +7 -6
- package/dist/packages/range/index.scss +109 -2
- package/dist/packages/searchbar/index.scss +7 -7
- package/dist/packages/sidenavbaritem/index.scss +5 -5
- package/dist/packages/step/index.scss +29 -29
- package/dist/packages/subsidenavbar/index.scss +10 -8
- package/dist/packages/tabbaritem/index.scss +15 -0
- package/dist/packages/timedetail/index.scss +13 -13
- package/dist/packages/timepannel/index.scss +7 -7
- package/dist/packages/timeselect/index.scss +3 -3
- package/dist/packages/uploader/index.scss +6 -6
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +64 -62
- package/dist/styles/themes/jdt.scss +91 -0
- package/dist/styles/variables-jdt.scss +728 -0
- package/dist/styles/variables.scss +250 -44
- package/package.json +2 -1
- package/dist/packages/_es/raf.js +0 -19
- package/dist/styles/themes/jdd.scss +0 -2
|
@@ -1,14 +1,37 @@
|
|
|
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));
|
|
1
20
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2022 @jdf2e.
|
|
4
23
|
* Released under the MIT License.
|
|
5
24
|
*/
|
|
6
|
-
import { reactive, computed,
|
|
25
|
+
import { reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, createVNode, normalizeStyle, withCtx, renderSlot, createElementVNode, normalizeClass, withModifiers } from "vue";
|
|
7
26
|
import { c as createComponent } from "./component.js";
|
|
8
27
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
28
|
const { componentName, create } = createComponent("backtop");
|
|
10
29
|
const _sfc_main = create({
|
|
11
30
|
props: {
|
|
31
|
+
height: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "100vh"
|
|
34
|
+
},
|
|
12
35
|
bottom: {
|
|
13
36
|
type: Number,
|
|
14
37
|
default: 20
|
|
@@ -17,35 +40,20 @@ const _sfc_main = create({
|
|
|
17
40
|
type: Number,
|
|
18
41
|
default: 10
|
|
19
42
|
},
|
|
20
|
-
elId: {
|
|
21
|
-
type: [String, Element],
|
|
22
|
-
default: "body"
|
|
23
|
-
},
|
|
24
|
-
distance: {
|
|
25
|
-
type: Number,
|
|
26
|
-
default: 200
|
|
27
|
-
},
|
|
28
43
|
zIndex: {
|
|
29
44
|
type: Number,
|
|
30
45
|
default: 10
|
|
31
46
|
},
|
|
32
|
-
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: true
|
|
35
|
-
},
|
|
36
|
-
duration: {
|
|
47
|
+
distance: {
|
|
37
48
|
type: Number,
|
|
38
|
-
default:
|
|
49
|
+
default: 200
|
|
39
50
|
}
|
|
40
51
|
},
|
|
41
52
|
emits: ["click"],
|
|
42
53
|
setup(props, { emit }) {
|
|
43
54
|
const state = reactive({
|
|
44
55
|
backTop: false,
|
|
45
|
-
scrollTop:
|
|
46
|
-
scrollEl: window,
|
|
47
|
-
startTime: 0,
|
|
48
|
-
keepAlive: false
|
|
56
|
+
scrollTop: 1
|
|
49
57
|
});
|
|
50
58
|
const classes = computed(() => {
|
|
51
59
|
const prefixCls = componentName;
|
|
@@ -61,99 +69,52 @@ const _sfc_main = create({
|
|
|
61
69
|
zIndex: props.zIndex
|
|
62
70
|
};
|
|
63
71
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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();
|
|
72
|
+
const scroll = (e) => {
|
|
73
|
+
state.scrollTop = 2;
|
|
74
|
+
state.backTop = e.detail.scrollTop >= props.distance;
|
|
75
|
+
};
|
|
76
|
+
const click = (e) => {
|
|
77
|
+
state.scrollTop = 1;
|
|
109
78
|
emit("click", e);
|
|
110
|
-
}
|
|
111
|
-
|
|
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,
|
|
79
|
+
};
|
|
80
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
136
81
|
classes,
|
|
137
82
|
style,
|
|
83
|
+
scroll,
|
|
138
84
|
click
|
|
139
|
-
};
|
|
85
|
+
});
|
|
140
86
|
}
|
|
141
87
|
});
|
|
142
88
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
89
|
+
const _component_scroll_view = resolveComponent("scroll-view");
|
|
143
90
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
144
|
-
return openBlock(), createElementBlock("
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
91
|
+
return openBlock(), createElementBlock("view", null, [
|
|
92
|
+
createVNode(_component_scroll_view, {
|
|
93
|
+
"scroll-y": true,
|
|
94
|
+
style: normalizeStyle({ height: _ctx.height }),
|
|
95
|
+
onScroll: _ctx.scroll,
|
|
96
|
+
"scroll-top": _ctx.scrollTop,
|
|
97
|
+
"scroll-with-animation": "true"
|
|
98
|
+
}, {
|
|
99
|
+
default: withCtx(() => [
|
|
100
|
+
renderSlot(_ctx.$slots, "content")
|
|
101
|
+
]),
|
|
102
|
+
_: 3
|
|
103
|
+
}, 8, ["style", "onScroll", "scroll-top"]),
|
|
104
|
+
createElementVNode("view", {
|
|
105
|
+
class: normalizeClass(_ctx.classes),
|
|
106
|
+
style: normalizeStyle(_ctx.style),
|
|
107
|
+
onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.click && _ctx.click(...args), ["stop"]))
|
|
108
|
+
}, [
|
|
109
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
110
|
+
createVNode(_component_nut_icon, {
|
|
111
|
+
size: "19px",
|
|
112
|
+
class: "nut-backtop-main",
|
|
113
|
+
name: "top"
|
|
114
|
+
})
|
|
115
|
+
])
|
|
116
|
+
], 6)
|
|
117
|
+
]);
|
|
157
118
|
}
|
|
158
|
-
var
|
|
159
|
-
export {
|
|
119
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
120
|
+
export { index_taro as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @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";
|
|
@@ -86,5 +86,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
86
86
|
])
|
|
87
87
|
]);
|
|
88
88
|
}
|
|
89
|
-
var
|
|
90
|
-
export {
|
|
89
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
90
|
+
export { index_taro as default };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ref, computed, onMounted, onUnmounted, onDeactivated, watch, reactive, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
|
+
import Taro from "@tarojs/taro";
|
|
8
9
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
10
|
const { componentName, create } = createComponent("barrage");
|
|
10
11
|
const _sfc_main = create({
|
|
@@ -15,7 +16,7 @@ const _sfc_main = create({
|
|
|
15
16
|
},
|
|
16
17
|
frequency: {
|
|
17
18
|
type: Number,
|
|
18
|
-
default:
|
|
19
|
+
default: 200
|
|
19
20
|
},
|
|
20
21
|
speeds: {
|
|
21
22
|
type: Number,
|
|
@@ -36,83 +37,89 @@ const _sfc_main = create({
|
|
|
36
37
|
},
|
|
37
38
|
emits: ["click"],
|
|
38
39
|
setup(props, { emit }) {
|
|
40
|
+
const timeId = ref(new Date().getTime());
|
|
41
|
+
const danmuList = ref(props.danmu);
|
|
42
|
+
const rows = ref(props.rows);
|
|
43
|
+
const top = ref(props.top);
|
|
44
|
+
const speeds = props.speeds;
|
|
39
45
|
const classes = computed(() => {
|
|
40
46
|
const prefixCls = componentName;
|
|
41
47
|
return {
|
|
42
|
-
[prefixCls]: true
|
|
48
|
+
[prefixCls]: true,
|
|
49
|
+
["dmBody" + timeId.value]: true
|
|
43
50
|
};
|
|
44
51
|
});
|
|
45
|
-
let dmBody = ref(document.createElement("div"));
|
|
46
|
-
let dmContainer = ref(document.createElement("div"));
|
|
47
|
-
let timer = 0;
|
|
48
|
-
const danmuList = ref(props.danmu);
|
|
49
|
-
const rows = ref(props.rows);
|
|
50
|
-
const top = ref(props.top);
|
|
51
|
-
const index2 = ref(0);
|
|
52
|
-
const speeds = props.speeds;
|
|
53
|
-
const danmuCWidth = ref(0);
|
|
54
52
|
onMounted(() => {
|
|
55
|
-
|
|
56
|
-
run();
|
|
53
|
+
runStep();
|
|
57
54
|
});
|
|
58
55
|
onUnmounted(() => {
|
|
59
|
-
|
|
60
|
-
timer = 0;
|
|
56
|
+
danmuList.value = [];
|
|
61
57
|
});
|
|
62
58
|
onDeactivated(() => {
|
|
63
|
-
|
|
64
|
-
timer = 0;
|
|
59
|
+
danmuList.value = [];
|
|
65
60
|
});
|
|
66
61
|
watch(() => props.danmu, (newValue, oldVlaue) => {
|
|
67
62
|
danmuList.value = [...newValue];
|
|
68
63
|
});
|
|
69
64
|
const add = (word) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
const run = () => {
|
|
74
|
-
clearInterval(timer);
|
|
75
|
-
timer = 0;
|
|
76
|
-
timer = setInterval(() => {
|
|
77
|
-
play();
|
|
78
|
-
run();
|
|
79
|
-
}, props.frequency);
|
|
65
|
+
danmuList.value = [...danmuList.value, word];
|
|
66
|
+
runStep();
|
|
80
67
|
};
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
nextTick(() => {
|
|
88
|
-
const width = el.offsetWidth;
|
|
89
|
-
const height = el.offsetHeight;
|
|
90
|
-
el.classList.add("move");
|
|
91
|
-
el.style.animationDuration = `${speeds}ms`;
|
|
92
|
-
el.style.top = _index % rows.value * (height + top.value) + 20 + "px";
|
|
93
|
-
el.style.width = width + 20 + "px";
|
|
94
|
-
el.style.setProperty("--move-distance", `-${danmuCWidth.value}px`);
|
|
95
|
-
el.dataset.index = `${_index}`;
|
|
96
|
-
el.addEventListener("animationend", () => {
|
|
97
|
-
dmContainer.value.removeChild(el);
|
|
68
|
+
const getNode = (index) => {
|
|
69
|
+
const query = Taro.createSelectorQuery();
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
let width = 100;
|
|
72
|
+
query.select(".dmBody" + timeId.value).boundingClientRect((rec) => {
|
|
73
|
+
width = rec.width || 300;
|
|
98
74
|
});
|
|
99
|
-
|
|
75
|
+
query.select(".dmitem" + index).boundingClientRect((recs) => {
|
|
76
|
+
let height = recs.height;
|
|
77
|
+
let nodeTop = index % rows.value * (height + top.value) + 20 + "px";
|
|
78
|
+
styleInfo(index, nodeTop, width);
|
|
79
|
+
}).exec();
|
|
80
|
+
}, 500);
|
|
81
|
+
};
|
|
82
|
+
const runStep = () => {
|
|
83
|
+
danmuList.value.forEach((item, index) => {
|
|
84
|
+
getNode(index);
|
|
100
85
|
});
|
|
101
86
|
};
|
|
102
|
-
|
|
87
|
+
let styleList = reactive([]);
|
|
88
|
+
const styleInfo = (index, nodeTop, width) => {
|
|
89
|
+
let timeIndex = index - rows.value > 0 ? index - rows.value : 0;
|
|
90
|
+
let list = styleList;
|
|
91
|
+
let time = list[timeIndex] ? Number(list[timeIndex]["--time"]) : 0;
|
|
92
|
+
let obj = {
|
|
93
|
+
top: nodeTop,
|
|
94
|
+
"--time": `${props.frequency * index + time}`,
|
|
95
|
+
animationDuration: `${speeds}ms`,
|
|
96
|
+
animationIterationCount: `${props.loop ? "infinite" : 1}`,
|
|
97
|
+
animationDelay: `${props.frequency * index + time}ms`,
|
|
98
|
+
"--move-distance": `-${width}px`
|
|
99
|
+
};
|
|
100
|
+
styleList.push(obj);
|
|
101
|
+
};
|
|
102
|
+
return { classes, danmuList, add, styleList };
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
const _hoisted_1 = {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
class: "dmContainer",
|
|
107
|
+
id: "dmContainer"
|
|
108
108
|
};
|
|
109
109
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
110
110
|
return openBlock(), createElementBlock("view", {
|
|
111
|
-
|
|
112
|
-
class: normalizeClass(_ctx.classes)
|
|
111
|
+
class: normalizeClass(["dmBody", _ctx.classes])
|
|
113
112
|
}, [
|
|
114
|
-
createElementVNode("view", _hoisted_1,
|
|
113
|
+
createElementVNode("view", _hoisted_1, [
|
|
114
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.danmuList, (item, index) => {
|
|
115
|
+
return openBlock(), createElementBlock("view", {
|
|
116
|
+
key: "danmu" + index,
|
|
117
|
+
class: normalizeClass(["dmitem", "dmitem" + index, "move"]),
|
|
118
|
+
style: normalizeStyle(_ctx.styleList[index])
|
|
119
|
+
}, toDisplayString(item.length > 8 ? item.substr(0, 8) + "..." : item), 7);
|
|
120
|
+
}), 128))
|
|
121
|
+
])
|
|
115
122
|
], 2);
|
|
116
123
|
}
|
|
117
|
-
var
|
|
118
|
-
export {
|
|
124
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
125
|
+
export { index_taro as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
3
|
-
* (c)
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { toRefs, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createBlock, createCommentVNode, renderSlot } from "vue";
|
|
@@ -104,7 +104,7 @@ const _sfc_main = create({
|
|
|
104
104
|
const _hoisted_1 = { class: "nut-button__warp" };
|
|
105
105
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
106
106
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
107
|
-
return openBlock(), createElementBlock("
|
|
107
|
+
return openBlock(), createElementBlock("button", {
|
|
108
108
|
class: normalizeClass(_ctx.classes),
|
|
109
109
|
style: normalizeStyle(_ctx.getStyle),
|
|
110
110
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|