@nutui/nutui 3.1.15 → 3.1.17-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.
- package/CHANGELOG.md +22 -1
- package/dist/nutui.d.ts +3 -1
- package/dist/nutui.es.js +2037 -1005
- package/dist/nutui.umd.js +2043 -1006
- package/dist/packages/_es/ActionSheet.js +2 -2
- package/dist/packages/_es/Address.js +60 -7
- package/dist/packages/_es/Audio.js +289 -0
- package/dist/packages/_es/Avatar.js +1 -1
- package/dist/packages/_es/BackTop.js +1 -1
- package/dist/packages/_es/Badge.js +1 -1
- package/dist/packages/_es/Barrage.js +1 -1
- package/dist/packages/_es/Button.js +13 -4
- package/dist/packages/_es/Calendar.js +428 -209
- package/dist/packages/_es/Card.js +1 -2
- package/dist/packages/_es/Cascader.js +2 -2
- package/dist/packages/_es/Cell.js +1 -1
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +2 -2
- package/dist/packages/_es/CheckboxGroup.js +1 -1
- package/dist/packages/_es/CircleProgress.js +1 -1
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +1 -1
- package/dist/packages/_es/CollapseItem.js +1 -1
- package/dist/packages/_es/CountDown.js +1 -1
- package/dist/packages/_es/CountUp.js +1 -1
- package/dist/packages/_es/DatePicker.js +1 -3
- package/dist/packages/_es/Dialog.js +1 -1
- package/dist/packages/_es/Divider.js +1 -1
- package/dist/packages/_es/Drag.js +1 -1
- package/dist/packages/_es/Elevator.js +10 -5
- package/dist/packages/_es/Empty.js +1 -1
- package/dist/packages/_es/FixedNav.js +1 -1
- package/dist/packages/_es/Form.js +1 -1
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +1 -1
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +1 -3
- package/dist/packages/_es/Indicator.js +1 -1
- package/dist/packages/_es/InfiniteLoading.js +1 -1
- package/dist/packages/_es/Input.js +21 -11
- package/dist/packages/_es/InputNumber.js +1 -1
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/Menu.js +2 -2
- package/dist/packages/_es/MenuItem.js +1 -1
- package/dist/packages/_es/Navbar.js +6 -32
- package/dist/packages/_es/NoticeBar.js +1 -4
- package/dist/packages/_es/Notify.js +1 -1
- package/dist/packages/_es/NumberKeyboard.js +1 -2
- package/dist/packages/_es/OverLay.js +1 -1
- package/dist/packages/_es/Pagination.js +1 -1
- package/dist/packages/_es/Picker.js +170 -189
- package/dist/packages/_es/Popover.js +1 -1
- package/dist/packages/_es/Popup.js +1 -1
- package/dist/packages/_es/Price.js +2 -2
- package/dist/packages/_es/Progress.js +24 -11
- package/dist/packages/_es/Radio.js +2 -2
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +3 -3
- package/dist/packages/_es/Rate.js +1 -1
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +1 -1
- package/dist/packages/_es/ShortPassword.js +5 -2
- package/dist/packages/_es/SideNavBar.js +1 -1
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +1 -1
- package/dist/packages/_es/Skeleton.js +8 -6
- package/dist/packages/_es/Sku.js +1 -2
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +143 -0
- package/dist/packages/_es/SubSideNavBar.js +1 -1
- package/dist/packages/_es/Swipe.js +2 -2
- package/dist/packages/_es/Swiper.js +1 -1
- package/dist/packages/_es/SwiperItem.js +3 -8
- package/dist/packages/_es/Switch.js +2 -2
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +1 -1
- package/dist/packages/_es/TabbarItem.js +1 -1
- package/dist/packages/_es/Table.js +2 -2
- package/dist/packages/_es/Tabs.js +1 -1
- package/dist/packages/_es/Tag.js +1 -1
- package/dist/packages/_es/TextArea.js +1 -1
- package/dist/packages/_es/TimeDetail.js +1 -1
- package/dist/packages/_es/TimePannel.js +1 -1
- package/dist/packages/_es/TimeSelect.js +1 -1
- package/dist/packages/_es/Toast.js +1 -1
- package/dist/packages/_es/Uploader.js +6 -4
- package/dist/packages/_es/Video.js +1 -55
- package/dist/packages/_es/common.js +1 -1
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index2.js +28 -56
- package/dist/packages/_es/index3.js +56 -28
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/address/index.scss +8 -0
- package/dist/packages/audio/index.scss +66 -0
- package/dist/packages/audiooperate/index.scss +13 -0
- package/dist/packages/button/index.scss +3 -0
- package/dist/packages/calendar/index.scss +47 -41
- package/dist/packages/calendaritem/index.scss +57 -42
- package/dist/packages/elevator/index.scss +3 -0
- package/dist/packages/icon/index.scss +2 -2
- package/dist/packages/infiniteloading/index.scss +1 -1
- package/dist/packages/input/index.scss +8 -3
- package/dist/packages/menuitem/index.scss +1 -1
- package/dist/packages/navbar/index.scss +8 -34
- package/dist/packages/picker/index.scss +73 -17
- package/dist/packages/range/index.scss +4 -4
- package/dist/packages/row/index.scss +3 -0
- package/dist/packages/sticky/index.scss +5 -0
- package/dist/packages/tabbar/index.scss +4 -2
- package/dist/style.css +1 -1
- package/dist/styles/font/config.json +6 -1
- package/dist/styles/font/demo_index.html +118 -3
- package/dist/styles/font/iconfont.css +23 -3
- package/dist/styles/font/iconfont.js +25 -24
- package/dist/styles/font/iconfont.json +35 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +40 -37
- package/dist/styles/variables.scss +34 -31
- package/package.json +12 -13
|
@@ -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.
|
|
21
|
+
* @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -65,7 +65,7 @@ const _sfc_main = create({
|
|
|
65
65
|
default: () => []
|
|
66
66
|
}
|
|
67
67
|
}),
|
|
68
|
-
emits: ["cancel", "choose", "update:visible"],
|
|
68
|
+
emits: ["cancel", "close", "choose", "update:visible"],
|
|
69
69
|
setup(props, { emit }) {
|
|
70
70
|
const classes = computed(() => {
|
|
71
71
|
const prefixCls = componentName;
|
|
@@ -15,17 +15,21 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
/*!
|
|
18
|
-
* @nutui/nutui v3.1.
|
|
18
|
+
* @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
|
|
19
19
|
* (c) 2021 @jdf2e.
|
|
20
20
|
* Released under the MIT License.
|
|
21
21
|
*/
|
|
22
|
-
import { ref, computed, reactive, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withDirectives, createVNode, vShow, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, createTextVNode
|
|
22
|
+
import { ref, computed, reactive, onMounted, watch, toRefs, nextTick, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withDirectives, createVNode, vShow, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, createTextVNode } from "vue";
|
|
23
23
|
import { c as createComponent } from "./component.js";
|
|
24
24
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
25
25
|
const { componentName, create } = createComponent("address");
|
|
26
26
|
const _sfc_main = create({
|
|
27
27
|
inheritAttrs: false,
|
|
28
28
|
props: {
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => []
|
|
32
|
+
},
|
|
29
33
|
visible: {
|
|
30
34
|
type: Boolean,
|
|
31
35
|
default: false
|
|
@@ -89,9 +93,13 @@ const _sfc_main = create({
|
|
|
89
93
|
height: {
|
|
90
94
|
type: [String, Number],
|
|
91
95
|
default: "200px"
|
|
96
|
+
},
|
|
97
|
+
columnsPlaceholder: {
|
|
98
|
+
type: [String, Array],
|
|
99
|
+
default: "\u8BF7\u9009\u62E9"
|
|
92
100
|
}
|
|
93
101
|
},
|
|
94
|
-
emits: ["update:visible", "type", "change", "selected", "close", "close-mask", "switch-module"],
|
|
102
|
+
emits: ["update:visible", "update:modelValue", "type", "change", "selected", "close", "close-mask", "switch-module"],
|
|
95
103
|
setup(props, { emit }) {
|
|
96
104
|
const regionLine = ref(null);
|
|
97
105
|
const tabRegion = ref(null);
|
|
@@ -99,6 +107,7 @@ const _sfc_main = create({
|
|
|
99
107
|
const privateType = ref(props.type);
|
|
100
108
|
const tabIndex = ref(0);
|
|
101
109
|
const tabName = ref(["province", "city", "country", "town"]);
|
|
110
|
+
const tabNameDefault = ref([""]);
|
|
102
111
|
const isCustom2 = computed(() => props.type === "custom2");
|
|
103
112
|
const transformData = (data) => {
|
|
104
113
|
if (!Array.isArray(data))
|
|
@@ -146,13 +155,55 @@ const _sfc_main = create({
|
|
|
146
155
|
let selectedExistAddress = reactive({});
|
|
147
156
|
const closeWay = ref("self");
|
|
148
157
|
const lineDistance = ref(20);
|
|
158
|
+
onMounted(() => {
|
|
159
|
+
customPlaceholder();
|
|
160
|
+
});
|
|
161
|
+
const initCustomSelected = () => {
|
|
162
|
+
if (props.modelValue.length > 0) {
|
|
163
|
+
tabIndex.value = props.modelValue.length - 1;
|
|
164
|
+
for (let index2 = 0; index2 < props.modelValue.length; index2++) {
|
|
165
|
+
if (regionList[tabName.value[index2]].length == 0) {
|
|
166
|
+
tabIndex.value = index2 - 1;
|
|
167
|
+
break;
|
|
168
|
+
} else {
|
|
169
|
+
const val = props.modelValue[index2];
|
|
170
|
+
const arr = regionList[tabName.value[index2]];
|
|
171
|
+
if (privateType.value == "custom") {
|
|
172
|
+
selectedRegion[tabName.value[index2]] = arr.filter((item) => item.id == val)[0];
|
|
173
|
+
} else if (privateType.value == "custom2") {
|
|
174
|
+
let sumArr = [];
|
|
175
|
+
arr.map((item) => {
|
|
176
|
+
sumArr.push(...item.list);
|
|
177
|
+
});
|
|
178
|
+
selectedRegion[tabName.value[index2]] = sumArr.filter((item) => item.id == val)[0];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
lineAnimation();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const customPlaceholder = () => {
|
|
186
|
+
let typeD = Object.prototype.toString.call(props.columnsPlaceholder);
|
|
187
|
+
if (typeD == "[object String]") {
|
|
188
|
+
tabNameDefault.value = new Array(4).fill(props.columnsPlaceholder);
|
|
189
|
+
} else if (typeD == "[object Array]") {
|
|
190
|
+
tabNameDefault.value = new Array(4).fill("");
|
|
191
|
+
tabNameDefault.value.forEach((val, index2) => {
|
|
192
|
+
if (props.columnsPlaceholder[index2]) {
|
|
193
|
+
tabNameDefault.value[index2] = props.columnsPlaceholder[index2];
|
|
194
|
+
} else {
|
|
195
|
+
tabNameDefault.value[index2] = "\u8BF7\u9009\u62E9";
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
};
|
|
149
200
|
const getTabName = (item, index2) => {
|
|
150
201
|
if (item.name)
|
|
151
202
|
return item.name;
|
|
152
203
|
if (tabIndex.value < index2) {
|
|
153
204
|
return item.name;
|
|
154
205
|
} else {
|
|
155
|
-
return
|
|
206
|
+
return tabNameDefault.value[index2];
|
|
156
207
|
}
|
|
157
208
|
};
|
|
158
209
|
const handClose = (type = "self") => {
|
|
@@ -165,7 +216,6 @@ const _sfc_main = create({
|
|
|
165
216
|
closeWay.value = "mask";
|
|
166
217
|
};
|
|
167
218
|
const lineAnimation = () => {
|
|
168
|
-
console.log("\u6ED1\u52A8\u7EA2\u7EBF");
|
|
169
219
|
nextTick(() => {
|
|
170
220
|
const name = tabRegion.value && tabRegion.value.getElementsByClassName("active")[0];
|
|
171
221
|
if (name) {
|
|
@@ -181,7 +231,7 @@ const _sfc_main = create({
|
|
|
181
231
|
custom: tabName.value[tabIndex.value]
|
|
182
232
|
};
|
|
183
233
|
selectedRegion[tabName.value[tabIndex.value]] = item;
|
|
184
|
-
for (let i = tabIndex.value; i <
|
|
234
|
+
for (let i = tabIndex.value; i < 4; i++) {
|
|
185
235
|
selectedRegion[tabName.value[i + 1]] = {};
|
|
186
236
|
}
|
|
187
237
|
if (tabIndex.value < 3) {
|
|
@@ -192,6 +242,7 @@ const _sfc_main = create({
|
|
|
192
242
|
emit("change", calBack);
|
|
193
243
|
} else {
|
|
194
244
|
handClose();
|
|
245
|
+
emit("update:modelValue");
|
|
195
246
|
}
|
|
196
247
|
};
|
|
197
248
|
const changeRegionTab = (item, key, index2) => {
|
|
@@ -274,6 +325,8 @@ const _sfc_main = create({
|
|
|
274
325
|
watch(() => showPopup.value, (value) => {
|
|
275
326
|
if (value == false) {
|
|
276
327
|
close();
|
|
328
|
+
} else {
|
|
329
|
+
initCustomSelected();
|
|
277
330
|
}
|
|
278
331
|
});
|
|
279
332
|
watch(() => props.province, (value) => {
|
|
@@ -383,7 +436,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
383
436
|
name: _ctx.backBtnIcon,
|
|
384
437
|
color: "#cccccc"
|
|
385
438
|
}, null, 8, ["name"]), [
|
|
386
|
-
[vShow, _ctx.privateType == "custom" && _ctx.backBtnIcon]
|
|
439
|
+
[vShow, _ctx.type == "exist" && _ctx.privateType == "custom" && _ctx.backBtnIcon]
|
|
387
440
|
])
|
|
388
441
|
]),
|
|
389
442
|
createElementVNode("view", _hoisted_3, toDisplayString(_ctx.privateType == "custom" ? _ctx.customAddressTitle : _ctx.existAddressTitle), 1),
|
|
@@ -0,0 +1,289 @@
|
|
|
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
|
+
/*!
|
|
21
|
+
* @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
|
|
22
|
+
* (c) 2021 @jdf2e.
|
|
23
|
+
* Released under the MIT License.
|
|
24
|
+
*/
|
|
25
|
+
import { ref, reactive, onMounted, watch, provide, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createCommentVNode, normalizeClass, createBlock, renderSlot } from "vue";
|
|
26
|
+
import { c as createComponent } from "./component.js";
|
|
27
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
28
|
+
const { componentName, create } = createComponent("audio");
|
|
29
|
+
const _sfc_main = create({
|
|
30
|
+
props: {
|
|
31
|
+
url: {
|
|
32
|
+
type: String,
|
|
33
|
+
default() {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
muted: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default() {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
autoplay: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default() {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
loop: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default() {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
preload: {
|
|
56
|
+
type: String,
|
|
57
|
+
default() {
|
|
58
|
+
return "auto";
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
second: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default() {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
type: String,
|
|
69
|
+
default() {
|
|
70
|
+
return "progress";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
components: {},
|
|
75
|
+
emits: ["fastBack", "play", "forward", "ended", "changeProgress", "mute"],
|
|
76
|
+
setup(props, { emit }) {
|
|
77
|
+
const audioRef = ref(null);
|
|
78
|
+
const audioData = reactive({
|
|
79
|
+
currentTime: 0,
|
|
80
|
+
currentDuration: "00:00:00",
|
|
81
|
+
percent: 0,
|
|
82
|
+
duration: "00:00:00",
|
|
83
|
+
second: 0,
|
|
84
|
+
hanMuted: props.muted,
|
|
85
|
+
playing: props.autoplay
|
|
86
|
+
});
|
|
87
|
+
onMounted(() => {
|
|
88
|
+
var arr = ["webkitVisibilityState", "visibilitychange"];
|
|
89
|
+
try {
|
|
90
|
+
for (let i = 0; i < arr.length; i++) {
|
|
91
|
+
document.addEventListener(arr[i], () => {
|
|
92
|
+
if (document.hidden) {
|
|
93
|
+
audioRef.value.pause();
|
|
94
|
+
} else {
|
|
95
|
+
if (audioData.playing) {
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
audioRef.value.play();
|
|
98
|
+
}, 200);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
} catch (e) {
|
|
104
|
+
console.log(e.message);
|
|
105
|
+
}
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
if (props.autoplay) {
|
|
108
|
+
if (audioRef.value && audioRef.value.paused) {
|
|
109
|
+
audioRef.value.play();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
audioData.second = audioRef.value.duration;
|
|
113
|
+
audioData.duration = formatSeconds(audioRef.value.duration);
|
|
114
|
+
}, 500);
|
|
115
|
+
});
|
|
116
|
+
const onTimeupdate = (e) => {
|
|
117
|
+
audioData.currentTime = parseInt(e.target.currentTime);
|
|
118
|
+
};
|
|
119
|
+
const fastBack = () => {
|
|
120
|
+
audioData.currentTime--;
|
|
121
|
+
audioRef.value.currentTime = audioData.currentTime;
|
|
122
|
+
emit("fastBack", audioData.currentTime);
|
|
123
|
+
};
|
|
124
|
+
const changeStatus = () => {
|
|
125
|
+
if (audioData.playing) {
|
|
126
|
+
audioRef.value.pause();
|
|
127
|
+
audioData.handPlaying = false;
|
|
128
|
+
} else {
|
|
129
|
+
audioRef.value.play();
|
|
130
|
+
audioData.handPlaying = true;
|
|
131
|
+
}
|
|
132
|
+
audioData.playing = !audioData.playing;
|
|
133
|
+
emit("play", audioData.playing);
|
|
134
|
+
};
|
|
135
|
+
const forward = () => {
|
|
136
|
+
audioData.currentTime++;
|
|
137
|
+
audioRef.value.currentTime = audioData.currentTime;
|
|
138
|
+
emit("forward", audioData.currentTime);
|
|
139
|
+
};
|
|
140
|
+
const handle = (val) => {
|
|
141
|
+
audioData.currentDuration = formatSeconds(val);
|
|
142
|
+
audioData.percent = val / audioData.second * 100;
|
|
143
|
+
};
|
|
144
|
+
const audioEnd = () => {
|
|
145
|
+
audioData.playing = false;
|
|
146
|
+
emit("ended");
|
|
147
|
+
};
|
|
148
|
+
const progressChange = (val) => {
|
|
149
|
+
audioRef.value.currentTime = audioData.second * val / 100;
|
|
150
|
+
emit("changeProgress", audioRef.value.currentTime);
|
|
151
|
+
};
|
|
152
|
+
const handleMute = () => {
|
|
153
|
+
audioData.hanMuted = !audioData.hanMuted;
|
|
154
|
+
emit("mute", audioData.hanMuted);
|
|
155
|
+
};
|
|
156
|
+
const formatSeconds = (value) => {
|
|
157
|
+
let theTime = parseInt(value);
|
|
158
|
+
let theTime1 = 0;
|
|
159
|
+
let theTime2 = 0;
|
|
160
|
+
if (theTime > 60) {
|
|
161
|
+
theTime1 = parseInt(theTime / 60);
|
|
162
|
+
theTime = parseInt(theTime % 60);
|
|
163
|
+
if (theTime1 > 60) {
|
|
164
|
+
theTime2 = parseInt(theTime1 / 60);
|
|
165
|
+
theTime1 = parseInt(theTime1 % 60);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
let result = "" + parseInt(theTime);
|
|
169
|
+
if (result < 10) {
|
|
170
|
+
result = "0" + result;
|
|
171
|
+
}
|
|
172
|
+
if (theTime1 > 0) {
|
|
173
|
+
result = "" + parseInt(theTime1) + ":" + result;
|
|
174
|
+
if (theTime1 < 10) {
|
|
175
|
+
result = "0" + result;
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
result = "00:" + result;
|
|
179
|
+
}
|
|
180
|
+
if (theTime2 > 0) {
|
|
181
|
+
result = "" + parseInt(theTime2) + ":" + result;
|
|
182
|
+
if (theTime2 < 10) {
|
|
183
|
+
result = "0" + result;
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
result = "00:" + result;
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
};
|
|
190
|
+
watch(() => audioData.currentTime, (value) => {
|
|
191
|
+
handle(value);
|
|
192
|
+
});
|
|
193
|
+
provide("audioParent", {
|
|
194
|
+
children: [],
|
|
195
|
+
props,
|
|
196
|
+
audioData,
|
|
197
|
+
handleMute,
|
|
198
|
+
forward,
|
|
199
|
+
fastBack,
|
|
200
|
+
changeStatus
|
|
201
|
+
});
|
|
202
|
+
return __spreadProps(__spreadValues(__spreadValues({}, toRefs(props)), toRefs(audioData)), {
|
|
203
|
+
audioRef,
|
|
204
|
+
fastBack,
|
|
205
|
+
forward,
|
|
206
|
+
changeStatus,
|
|
207
|
+
progressChange,
|
|
208
|
+
audioEnd,
|
|
209
|
+
onTimeupdate,
|
|
210
|
+
handleMute
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const _hoisted_1 = { class: "nut-audio" };
|
|
215
|
+
const _hoisted_2 = {
|
|
216
|
+
key: 0,
|
|
217
|
+
class: "progress-wrapper"
|
|
218
|
+
};
|
|
219
|
+
const _hoisted_3 = { class: "time" };
|
|
220
|
+
const _hoisted_4 = { class: "progress-bar-wrapper" };
|
|
221
|
+
const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", { class: "custom-button" }, null, -1);
|
|
222
|
+
const _hoisted_6 = { class: "time" };
|
|
223
|
+
const _hoisted_7 = {
|
|
224
|
+
key: 1,
|
|
225
|
+
class: "nut-audio-icon"
|
|
226
|
+
};
|
|
227
|
+
const _hoisted_8 = ["controls", "src", "preload", "autoplay", "loop", "muted"];
|
|
228
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
229
|
+
const _component_nut_range = resolveComponent("nut-range");
|
|
230
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
231
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
232
|
+
_ctx.type == "progress" ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
233
|
+
createElementVNode("div", _hoisted_3, toDisplayString(_ctx.currentDuration), 1),
|
|
234
|
+
createElementVNode("div", _hoisted_4, [
|
|
235
|
+
createVNode(_component_nut_range, {
|
|
236
|
+
modelValue: _ctx.percent,
|
|
237
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.percent = $event),
|
|
238
|
+
"hidden-range": "",
|
|
239
|
+
onChange: _ctx.progressChange,
|
|
240
|
+
"inactive-color": "#cccccc",
|
|
241
|
+
"active-color": "#fa2c19"
|
|
242
|
+
}, {
|
|
243
|
+
button: withCtx(() => [
|
|
244
|
+
_hoisted_5
|
|
245
|
+
]),
|
|
246
|
+
_: 1
|
|
247
|
+
}, 8, ["modelValue", "onChange"])
|
|
248
|
+
]),
|
|
249
|
+
createElementVNode("div", _hoisted_6, toDisplayString(_ctx.duration), 1)
|
|
250
|
+
])) : createCommentVNode("", true),
|
|
251
|
+
_ctx.type == "icon" ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
252
|
+
createElementVNode("div", {
|
|
253
|
+
class: normalizeClass(["nut-audio-icon-box", _ctx.playing ? "nut-audio-icon-play" : "nut-audio-icon-stop"]),
|
|
254
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
|
|
255
|
+
}, [
|
|
256
|
+
_ctx.playing ? (openBlock(), createBlock(_component_nut_icon, {
|
|
257
|
+
key: 0,
|
|
258
|
+
name: "service",
|
|
259
|
+
class: "nut-icon-am-rotate nut-icon-am-infinite"
|
|
260
|
+
})) : createCommentVNode("", true),
|
|
261
|
+
!_ctx.playing ? (openBlock(), createBlock(_component_nut_icon, {
|
|
262
|
+
key: 1,
|
|
263
|
+
name: "service"
|
|
264
|
+
})) : createCommentVNode("", true)
|
|
265
|
+
], 2)
|
|
266
|
+
])) : createCommentVNode("", true),
|
|
267
|
+
_ctx.type == "none" ? (openBlock(), createElementBlock("div", {
|
|
268
|
+
key: 2,
|
|
269
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
|
|
270
|
+
}, [
|
|
271
|
+
renderSlot(_ctx.$slots, "default")
|
|
272
|
+
])) : createCommentVNode("", true),
|
|
273
|
+
_ctx.type != "none" ? renderSlot(_ctx.$slots, "default", { key: 3 }) : createCommentVNode("", true),
|
|
274
|
+
createElementVNode("audio", {
|
|
275
|
+
class: "audioMain",
|
|
276
|
+
controls: _ctx.type == "controls",
|
|
277
|
+
ref: "audioRef",
|
|
278
|
+
src: _ctx.url,
|
|
279
|
+
preload: _ctx.preload,
|
|
280
|
+
autoplay: _ctx.autoplay,
|
|
281
|
+
loop: _ctx.loop,
|
|
282
|
+
onTimeupdate: _cache[3] || (_cache[3] = (...args) => _ctx.onTimeupdate && _ctx.onTimeupdate(...args)),
|
|
283
|
+
onEnded: _cache[4] || (_cache[4] = (...args) => _ctx.audioEnd && _ctx.audioEnd(...args)),
|
|
284
|
+
muted: _ctx.hanMuted
|
|
285
|
+
}, null, 40, _hoisted_8)
|
|
286
|
+
]);
|
|
287
|
+
}
|
|
288
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
289
|
+
export { index as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -46,6 +46,14 @@ const _sfc_main = create({
|
|
|
46
46
|
icon: {
|
|
47
47
|
type: String,
|
|
48
48
|
default: ""
|
|
49
|
+
},
|
|
50
|
+
iconClassPrefix: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "nut-icon"
|
|
53
|
+
},
|
|
54
|
+
iconFontClassName: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "nutui-iconfont"
|
|
49
57
|
}
|
|
50
58
|
},
|
|
51
59
|
emits: ["click"],
|
|
@@ -108,9 +116,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
108
116
|
})) : createCommentVNode("", true),
|
|
109
117
|
_ctx.icon && !_ctx.loading ? (openBlock(), createBlock(_component_nut_icon, {
|
|
110
118
|
key: 1,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
name: _ctx.icon,
|
|
120
|
+
"class-prefix": _ctx.iconClassPrefix,
|
|
121
|
+
"font-class-name": _ctx.iconFontClassName
|
|
122
|
+
}, null, 8, ["name", "class-prefix", "font-class-name"])) : createCommentVNode("", true),
|
|
114
123
|
_ctx.$slots.default ? (openBlock(), createElementBlock("view", {
|
|
115
124
|
key: 2,
|
|
116
125
|
class: normalizeClass({ text: _ctx.icon || _ctx.loading })
|