@nutui/nutui 4.0.11 → 4.0.12
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/dist/nutui.es.js +1 -1
- package/dist/nutui.js +2 -2
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +48 -48
- package/dist/styles/themes/jdb.scss +48 -48
- package/dist/styles/themes/jddkh.scss +48 -48
- package/dist/styles/themes/jdt.scss +48 -48
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -4
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
import { toRefs, reactive, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
21
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
22
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
16
23
|
import "../locale/lang";
|
|
17
|
-
const { componentName
|
|
24
|
+
const { componentName, create } = createComponent("animate");
|
|
25
|
+
const _sfc_main = create({
|
|
18
26
|
props: {
|
|
19
27
|
type: {
|
|
20
28
|
type: String,
|
|
@@ -26,44 +34,53 @@ const { componentName: b, create: D } = z("animate"), R = D({
|
|
|
26
34
|
},
|
|
27
35
|
loop: {
|
|
28
36
|
type: Boolean,
|
|
29
|
-
default:
|
|
37
|
+
default: false
|
|
30
38
|
},
|
|
31
39
|
duration: {
|
|
32
40
|
type: [String, Number]
|
|
33
41
|
}
|
|
34
42
|
},
|
|
35
43
|
emits: ["click"],
|
|
36
|
-
setup(
|
|
37
|
-
const { type
|
|
38
|
-
|
|
44
|
+
setup(props, { emit }) {
|
|
45
|
+
const { type, loop, action } = toRefs(props);
|
|
46
|
+
const state = reactive({
|
|
47
|
+
clicked: false
|
|
48
|
+
});
|
|
49
|
+
let classes = computed(() => {
|
|
50
|
+
const prefixCls = componentName;
|
|
51
|
+
return {
|
|
52
|
+
"nut-animate__container": true,
|
|
53
|
+
[`${prefixCls}-${type.value}`]: action.value === "initial" || state.clicked ? type.value : false,
|
|
54
|
+
loop: loop.value
|
|
55
|
+
};
|
|
39
56
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, 1e3), t("click", s);
|
|
57
|
+
const handleClick = (event) => {
|
|
58
|
+
state.clicked = true;
|
|
59
|
+
if (!loop.value) {
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
state.clicked = false;
|
|
62
|
+
}, 1e3);
|
|
63
|
+
}
|
|
64
|
+
emit("click", event);
|
|
49
65
|
};
|
|
50
|
-
return
|
|
66
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), { classes, handleClick });
|
|
51
67
|
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
68
|
+
});
|
|
69
|
+
const _hoisted_1 = { class: "nut-animate" };
|
|
70
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
71
|
+
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
72
|
+
createElementVNode("view", {
|
|
73
|
+
class: normalizeClass(_ctx.classes),
|
|
74
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
|
|
75
|
+
style: normalizeStyle({
|
|
76
|
+
animationDuration: _ctx.duration ? `${_ctx.duration}ms` : void 0
|
|
60
77
|
})
|
|
61
78
|
}, [
|
|
62
|
-
|
|
79
|
+
renderSlot(_ctx.$slots, "default")
|
|
63
80
|
], 6)
|
|
64
81
|
]);
|
|
65
82
|
}
|
|
66
|
-
const
|
|
83
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
67
84
|
export {
|
|
68
|
-
|
|
85
|
+
index as default
|
|
69
86
|
};
|
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
import { ref, reactive, onMounted, watch, provide, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createCommentVNode, normalizeClass, createBlock, renderSlot } from "vue";
|
|
21
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
22
|
+
import { Service } from "@nutui/icons-vue";
|
|
23
|
+
import Range from "./Range.js";
|
|
24
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
18
25
|
import "../locale/lang";
|
|
19
|
-
import "./index-
|
|
20
|
-
import "./index-
|
|
21
|
-
const { componentName
|
|
26
|
+
import "./index-7a7385e4.js";
|
|
27
|
+
import "./index-29892cda.js";
|
|
28
|
+
const { componentName, create } = createComponent("audio");
|
|
29
|
+
const _sfc_main = create({
|
|
22
30
|
props: {
|
|
23
31
|
url: {
|
|
24
32
|
type: String,
|
|
@@ -27,17 +35,17 @@ const { componentName: he, create: Y } = Q("audio"), Z = Y({
|
|
|
27
35
|
// 静音
|
|
28
36
|
muted: {
|
|
29
37
|
type: Boolean,
|
|
30
|
-
default:
|
|
38
|
+
default: false
|
|
31
39
|
},
|
|
32
40
|
// 自动播放
|
|
33
41
|
autoplay: {
|
|
34
42
|
type: Boolean,
|
|
35
|
-
default:
|
|
43
|
+
default: false
|
|
36
44
|
},
|
|
37
45
|
// 循环播放
|
|
38
46
|
loop: {
|
|
39
47
|
type: Boolean,
|
|
40
|
-
default:
|
|
48
|
+
default: false
|
|
41
49
|
},
|
|
42
50
|
// 是否预加载音频
|
|
43
51
|
preload: {
|
|
@@ -56,150 +64,211 @@ const { componentName: he, create: Y } = Q("audio"), Z = Y({
|
|
|
56
64
|
}
|
|
57
65
|
},
|
|
58
66
|
components: {
|
|
59
|
-
Service
|
|
60
|
-
[
|
|
67
|
+
Service,
|
|
68
|
+
[Range.name]: Range
|
|
61
69
|
},
|
|
62
70
|
emits: ["fastBack", "play", "forward", "ended", "changeProgress", "mute", "can-play"],
|
|
63
|
-
setup(
|
|
64
|
-
const
|
|
71
|
+
setup(props, { emit, slots }) {
|
|
72
|
+
const audioRef = ref(null);
|
|
73
|
+
const audioData = reactive({
|
|
65
74
|
currentTime: 0,
|
|
66
75
|
currentDuration: "00:00:00",
|
|
67
76
|
percent: 0,
|
|
68
77
|
duration: "00:00:00",
|
|
69
78
|
second: 0,
|
|
70
|
-
hanMuted:
|
|
71
|
-
playing:
|
|
72
|
-
handPlaying:
|
|
79
|
+
hanMuted: props.muted,
|
|
80
|
+
playing: props.autoplay,
|
|
81
|
+
handPlaying: false
|
|
73
82
|
});
|
|
74
|
-
|
|
75
|
-
var
|
|
83
|
+
onMounted(() => {
|
|
84
|
+
var arr = ["webkitVisibilityState", "visibilitychange"];
|
|
76
85
|
try {
|
|
77
|
-
for (let
|
|
78
|
-
document.addEventListener(
|
|
79
|
-
document.hidden
|
|
80
|
-
|
|
81
|
-
}
|
|
86
|
+
for (let i = 0; i < arr.length; i++) {
|
|
87
|
+
document.addEventListener(arr[i], () => {
|
|
88
|
+
if (document.hidden) {
|
|
89
|
+
audioRef.value.pause();
|
|
90
|
+
} else {
|
|
91
|
+
if (audioData.playing) {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
audioRef.value.play();
|
|
94
|
+
}, 200);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
82
97
|
});
|
|
83
|
-
|
|
84
|
-
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {
|
|
100
|
+
console.log(e.message);
|
|
85
101
|
}
|
|
86
102
|
});
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
const onCanplay = (e) => {
|
|
104
|
+
const audioR = audioRef.value;
|
|
105
|
+
if (props.autoplay) {
|
|
106
|
+
if (audioR && audioR.paused) {
|
|
107
|
+
audioR.play();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
audioData.second = audioR.duration;
|
|
111
|
+
audioData.duration = formatSeconds(audioR.duration);
|
|
112
|
+
emit("can-play", e);
|
|
113
|
+
};
|
|
114
|
+
const onTimeupdate = (e) => {
|
|
115
|
+
audioData.currentTime = parseInt(e.target.currentTime);
|
|
116
|
+
};
|
|
117
|
+
const fastBack = () => {
|
|
118
|
+
if (audioData.currentTime > 0) {
|
|
119
|
+
audioData.currentTime--;
|
|
120
|
+
}
|
|
121
|
+
audioRef.value.currentTime = audioData.currentTime;
|
|
122
|
+
emit("fastBack", audioData.currentTime);
|
|
123
|
+
};
|
|
124
|
+
const changeStatus = () => {
|
|
125
|
+
const audioR = audioRef.value;
|
|
126
|
+
if (audioData.playing) {
|
|
127
|
+
audioR.pause();
|
|
128
|
+
audioData.handPlaying = false;
|
|
129
|
+
} else {
|
|
130
|
+
audioR.play();
|
|
131
|
+
audioData.handPlaying = true;
|
|
132
|
+
}
|
|
133
|
+
audioData.playing = !audioData.playing;
|
|
134
|
+
emit("play", audioData.playing);
|
|
135
|
+
};
|
|
136
|
+
const forward = () => {
|
|
137
|
+
audioData.currentTime++;
|
|
138
|
+
audioRef.value.currentTime = audioData.currentTime;
|
|
139
|
+
emit("forward", audioData.currentTime);
|
|
140
|
+
};
|
|
141
|
+
const handle = (val) => {
|
|
142
|
+
audioData.currentDuration = formatSeconds(val);
|
|
143
|
+
audioData.percent = val / audioData.second * 100;
|
|
144
|
+
};
|
|
145
|
+
const audioEnd = () => {
|
|
146
|
+
audioData.playing = false;
|
|
147
|
+
emit("ended");
|
|
148
|
+
};
|
|
149
|
+
const progressChange = (val) => {
|
|
150
|
+
const ar = audioRef.value;
|
|
151
|
+
ar.currentTime = audioData.second * val / 100;
|
|
152
|
+
emit("changeProgress", ar.currentTime);
|
|
153
|
+
};
|
|
154
|
+
const handleMute = () => {
|
|
155
|
+
audioData.hanMuted = !audioData.hanMuted;
|
|
156
|
+
emit("mute", audioData.hanMuted);
|
|
157
|
+
};
|
|
158
|
+
const formatSeconds = (value) => {
|
|
159
|
+
if (!value) {
|
|
110
160
|
return "00:00:00";
|
|
111
|
-
|
|
112
|
-
|
|
161
|
+
}
|
|
162
|
+
let time = parseInt(value);
|
|
163
|
+
let hours = Math.floor(time / 3600);
|
|
164
|
+
let minutes = Math.floor((time - hours * 3600) / 60);
|
|
165
|
+
let seconds = time - hours * 3600 - minutes * 60;
|
|
166
|
+
let result = "";
|
|
167
|
+
result += ("0" + hours.toString()).slice(-2) + ":";
|
|
168
|
+
result += ("0" + minutes.toString()).slice(-2) + ":";
|
|
169
|
+
result += ("0" + seconds.toString()).slice(-2);
|
|
170
|
+
return result;
|
|
113
171
|
};
|
|
114
|
-
|
|
115
|
-
() =>
|
|
116
|
-
(
|
|
117
|
-
|
|
172
|
+
watch(
|
|
173
|
+
() => audioData.currentTime,
|
|
174
|
+
(value) => {
|
|
175
|
+
handle(value);
|
|
118
176
|
}
|
|
119
|
-
)
|
|
177
|
+
);
|
|
178
|
+
provide("audioParent", {
|
|
120
179
|
children: [],
|
|
121
|
-
props
|
|
122
|
-
audioData
|
|
123
|
-
handleMute
|
|
124
|
-
forward
|
|
125
|
-
fastBack
|
|
126
|
-
changeStatus
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
180
|
+
props,
|
|
181
|
+
audioData,
|
|
182
|
+
handleMute,
|
|
183
|
+
forward,
|
|
184
|
+
fastBack,
|
|
185
|
+
changeStatus
|
|
186
|
+
});
|
|
187
|
+
return __spreadProps(__spreadValues(__spreadValues({}, toRefs(props)), toRefs(audioData)), {
|
|
188
|
+
audioRef,
|
|
189
|
+
fastBack,
|
|
190
|
+
forward,
|
|
191
|
+
changeStatus,
|
|
192
|
+
progressChange,
|
|
193
|
+
audioEnd,
|
|
194
|
+
onTimeupdate,
|
|
195
|
+
handleMute,
|
|
196
|
+
onCanplay,
|
|
197
|
+
slots
|
|
138
198
|
});
|
|
139
199
|
}
|
|
140
|
-
})
|
|
200
|
+
});
|
|
201
|
+
const _hoisted_1 = { class: "nut-audio" };
|
|
202
|
+
const _hoisted_2 = {
|
|
141
203
|
key: 0,
|
|
142
204
|
class: "nut-audio__progress"
|
|
143
|
-
}
|
|
205
|
+
};
|
|
206
|
+
const _hoisted_3 = { class: "nut-audio__time" };
|
|
207
|
+
const _hoisted_4 = { class: "nut-audio__bar" };
|
|
208
|
+
const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", { class: "nut-audio__button--custom" }, null, -1);
|
|
209
|
+
const _hoisted_6 = { class: "nut-audio__time" };
|
|
210
|
+
const _hoisted_7 = {
|
|
144
211
|
key: 1,
|
|
145
212
|
class: "nut-audio__icon"
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
213
|
+
};
|
|
214
|
+
const _hoisted_8 = ["controls", "src", "preload", "autoplay", "loop", "muted"];
|
|
215
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
216
|
+
const _component_nut_range = resolveComponent("nut-range");
|
|
217
|
+
const _component_Service = resolveComponent("Service");
|
|
218
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
219
|
+
_ctx.type == "progress" ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
220
|
+
createElementVNode("div", _hoisted_3, toDisplayString(_ctx.currentDuration), 1),
|
|
221
|
+
createElementVNode("div", _hoisted_4, [
|
|
222
|
+
createVNode(_component_nut_range, {
|
|
223
|
+
modelValue: _ctx.percent,
|
|
224
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.percent = $event),
|
|
156
225
|
"hidden-range": "",
|
|
157
|
-
onChange:
|
|
226
|
+
onChange: _ctx.progressChange,
|
|
158
227
|
"inactive-color": "#cccccc",
|
|
159
228
|
"active-color": "#fa2c19"
|
|
160
229
|
}, {
|
|
161
|
-
button:
|
|
162
|
-
|
|
230
|
+
button: withCtx(() => [
|
|
231
|
+
_hoisted_5
|
|
163
232
|
]),
|
|
164
233
|
_: 1
|
|
165
234
|
}, 8, ["modelValue", "onChange"])
|
|
166
235
|
]),
|
|
167
|
-
|
|
168
|
-
])) :
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
class:
|
|
172
|
-
onClick:
|
|
236
|
+
createElementVNode("div", _hoisted_6, toDisplayString(_ctx.duration), 1)
|
|
237
|
+
])) : createCommentVNode("", true),
|
|
238
|
+
_ctx.type == "icon" ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
239
|
+
createElementVNode("div", {
|
|
240
|
+
class: normalizeClass(["nut-audio__icon--box", _ctx.playing ? "nut-audio__icon--play" : "nut-audio__icon--stop"]),
|
|
241
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
|
|
173
242
|
}, [
|
|
174
|
-
|
|
243
|
+
_ctx.playing ? (openBlock(), createBlock(_component_Service, {
|
|
175
244
|
key: 0,
|
|
176
245
|
class: "nut-icon-am-rotate nut-icon-am-infinite"
|
|
177
|
-
})) : (
|
|
246
|
+
})) : (openBlock(), createBlock(_component_Service, { key: 1 }))
|
|
178
247
|
], 2)
|
|
179
|
-
])) :
|
|
180
|
-
|
|
248
|
+
])) : createCommentVNode("", true),
|
|
249
|
+
_ctx.type == "none" ? (openBlock(), createElementBlock("div", {
|
|
181
250
|
key: 2,
|
|
182
|
-
onClick:
|
|
251
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
|
|
183
252
|
}, [
|
|
184
|
-
|
|
185
|
-
])) :
|
|
186
|
-
|
|
187
|
-
|
|
253
|
+
renderSlot(_ctx.$slots, "default")
|
|
254
|
+
])) : createCommentVNode("", true),
|
|
255
|
+
_ctx.type != "none" ? renderSlot(_ctx.$slots, "default", { key: 3 }) : createCommentVNode("", true),
|
|
256
|
+
createElementVNode("audio", {
|
|
188
257
|
class: "audioMain",
|
|
189
|
-
controls:
|
|
258
|
+
controls: _ctx.type == "controls",
|
|
190
259
|
ref: "audioRef",
|
|
191
|
-
src:
|
|
192
|
-
preload:
|
|
193
|
-
autoplay:
|
|
194
|
-
loop:
|
|
195
|
-
onTimeupdate:
|
|
196
|
-
onCanplay:
|
|
197
|
-
onEnded:
|
|
198
|
-
muted:
|
|
199
|
-
}, null, 40,
|
|
260
|
+
src: _ctx.url,
|
|
261
|
+
preload: _ctx.preload,
|
|
262
|
+
autoplay: _ctx.autoplay,
|
|
263
|
+
loop: _ctx.loop,
|
|
264
|
+
onTimeupdate: _cache[3] || (_cache[3] = (...args) => _ctx.onTimeupdate && _ctx.onTimeupdate(...args)),
|
|
265
|
+
onCanplay: _cache[4] || (_cache[4] = (...args) => _ctx.onCanplay && _ctx.onCanplay(...args)),
|
|
266
|
+
onEnded: _cache[5] || (_cache[5] = (...args) => _ctx.audioEnd && _ctx.audioEnd(...args)),
|
|
267
|
+
muted: _ctx.hanMuted
|
|
268
|
+
}, null, 40, _hoisted_8)
|
|
200
269
|
]);
|
|
201
270
|
}
|
|
202
|
-
const
|
|
271
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
203
272
|
export {
|
|
204
|
-
|
|
273
|
+
index as default
|
|
205
274
|
};
|