@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,27 +1,44 @@
|
|
|
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 { reactive, ref, computed, watch, nextTick, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, createCommentVNode, withDirectives, vShow, normalizeClass, toDisplayString, normalizeStyle, withModifiers } 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
|
-
function
|
|
18
|
-
let
|
|
24
|
+
function throttle(fn, delay) {
|
|
25
|
+
let timer = null;
|
|
26
|
+
let startTime = Date.now();
|
|
19
27
|
return function() {
|
|
20
|
-
let
|
|
21
|
-
|
|
28
|
+
let now = Date.now();
|
|
29
|
+
let remaining = delay - (now - startTime);
|
|
30
|
+
if (timer)
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
if (remaining <= 0) {
|
|
33
|
+
fn.apply(null, arguments);
|
|
34
|
+
startTime = Date.now();
|
|
35
|
+
} else {
|
|
36
|
+
timer = setTimeout(fn, remaining);
|
|
37
|
+
}
|
|
22
38
|
};
|
|
23
39
|
}
|
|
24
|
-
const { create
|
|
40
|
+
const { create, translate } = createComponent("video");
|
|
41
|
+
const _sfc_main = create({
|
|
25
42
|
props: {
|
|
26
43
|
source: {
|
|
27
44
|
type: Object,
|
|
@@ -30,22 +47,22 @@ const { create: oe, translate: te } = x("video"), le = oe({
|
|
|
30
47
|
options: {
|
|
31
48
|
type: Object,
|
|
32
49
|
default: {
|
|
33
|
-
autoplay:
|
|
50
|
+
autoplay: false,
|
|
34
51
|
//是否自动播放
|
|
35
52
|
volume: 0.5,
|
|
36
53
|
poster: "",
|
|
37
|
-
loop:
|
|
38
|
-
controls:
|
|
39
|
-
muted:
|
|
54
|
+
loop: false,
|
|
55
|
+
controls: true,
|
|
56
|
+
muted: false,
|
|
40
57
|
//是否静音
|
|
41
|
-
disabled:
|
|
58
|
+
disabled: false,
|
|
42
59
|
//禁止操作
|
|
43
|
-
playsinline:
|
|
60
|
+
playsinline: false,
|
|
44
61
|
//行内展示
|
|
45
|
-
touchPlay:
|
|
62
|
+
touchPlay: false,
|
|
46
63
|
preload: ""
|
|
47
64
|
},
|
|
48
|
-
required:
|
|
65
|
+
required: true
|
|
49
66
|
},
|
|
50
67
|
model: {
|
|
51
68
|
type: String,
|
|
@@ -54,12 +71,12 @@ const { create: oe, translate: te } = x("video"), le = oe({
|
|
|
54
71
|
},
|
|
55
72
|
components: {},
|
|
56
73
|
emits: ["click", "play", "pause", "playend", "time"],
|
|
57
|
-
setup(
|
|
58
|
-
const
|
|
74
|
+
setup(props, { emit }) {
|
|
75
|
+
const state = reactive({
|
|
59
76
|
videoElm: null,
|
|
60
|
-
initial:
|
|
77
|
+
initial: true,
|
|
61
78
|
//控制封面的显示
|
|
62
|
-
showToolbox:
|
|
79
|
+
showToolbox: false,
|
|
63
80
|
//控制控制器和标题的显示
|
|
64
81
|
// 视频容器元素
|
|
65
82
|
player: {
|
|
@@ -88,214 +105,322 @@ const { create: oe, translate: te } = x("video"), le = oe({
|
|
|
88
105
|
}
|
|
89
106
|
},
|
|
90
107
|
state: {
|
|
91
|
-
controlShow:
|
|
108
|
+
controlShow: true,
|
|
92
109
|
vol: 0.5,
|
|
93
110
|
//音量
|
|
94
111
|
currentTime: 0,
|
|
95
112
|
//当前时间
|
|
96
|
-
fullScreen:
|
|
97
|
-
playing:
|
|
113
|
+
fullScreen: false,
|
|
114
|
+
playing: false,
|
|
98
115
|
//是否正在播放
|
|
99
|
-
isLoading:
|
|
100
|
-
isEnd:
|
|
101
|
-
isError:
|
|
102
|
-
isMuted:
|
|
116
|
+
isLoading: false,
|
|
117
|
+
isEnd: false,
|
|
118
|
+
isError: false,
|
|
119
|
+
isMuted: false
|
|
103
120
|
},
|
|
104
|
-
showTouchMask:
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
showTouchMask: false
|
|
122
|
+
});
|
|
123
|
+
const root = ref(null);
|
|
124
|
+
const isDisabled = computed(() => {
|
|
125
|
+
return props.options.disabled;
|
|
126
|
+
});
|
|
127
|
+
watch(
|
|
128
|
+
() => props.source,
|
|
129
|
+
(newValue) => {
|
|
130
|
+
if (newValue.src) {
|
|
131
|
+
nextTick(() => {
|
|
132
|
+
state.videoElm.load();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
112
135
|
},
|
|
113
|
-
{ immediate:
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
(
|
|
117
|
-
|
|
136
|
+
{ immediate: true, deep: true }
|
|
137
|
+
);
|
|
138
|
+
watch(
|
|
139
|
+
() => props.options,
|
|
140
|
+
(newValue) => {
|
|
141
|
+
state.state.isMuted = newValue ? newValue.muted : false;
|
|
118
142
|
},
|
|
119
|
-
{ immediate:
|
|
143
|
+
{ immediate: true }
|
|
120
144
|
);
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
const init = () => {
|
|
146
|
+
state.videoElm = root.value;
|
|
147
|
+
if (props.options.autoplay) {
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
state.videoElm.play();
|
|
150
|
+
}, 200);
|
|
151
|
+
}
|
|
152
|
+
if (props.options.touchPlay) {
|
|
153
|
+
state.showTouchMask = true;
|
|
154
|
+
}
|
|
155
|
+
if (props.options.playsinline) {
|
|
156
|
+
state.videoElm.setAttribute("playsinline", props.options.playsinline);
|
|
157
|
+
state.videoElm.setAttribute("webkit-playsinline", props.options.playsinline);
|
|
158
|
+
state.videoElm.setAttribute("x5-video-player-type", "h5-page");
|
|
159
|
+
state.videoElm.setAttribute("x5-video-player-fullscreen", false);
|
|
160
|
+
}
|
|
161
|
+
volumeHandle();
|
|
162
|
+
if (state.showToolbox) {
|
|
163
|
+
customerInit();
|
|
164
|
+
} else {
|
|
165
|
+
state.videoElm.addEventListener("play", () => {
|
|
166
|
+
state.state.playing = true;
|
|
167
|
+
emit("play", state.videoElm);
|
|
168
|
+
});
|
|
169
|
+
state.videoElm.addEventListener("pause", () => {
|
|
170
|
+
state.state.playing = false;
|
|
171
|
+
emit("pause", state.videoElm);
|
|
172
|
+
});
|
|
173
|
+
state.videoElm.addEventListener("ended", playEnded);
|
|
174
|
+
state.videoElm.addEventListener("timeupdate", throttle(getPlayTime, 1e3));
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const customerInit = () => {
|
|
178
|
+
const $player = root.value;
|
|
179
|
+
const $progress = root.value.getElementsByClassName("nut-video-controller__progress-value")[0];
|
|
180
|
+
state.player.$player = $player;
|
|
181
|
+
state.progressBar.progressElm = $progress;
|
|
182
|
+
state.progressBar.pos = $progress.getBoundingClientRect();
|
|
183
|
+
state.videoSet.progress.width = Math.round($progress.getBoundingClientRect().width);
|
|
184
|
+
};
|
|
185
|
+
const play = () => {
|
|
186
|
+
if (props.options.autoplay && props.options.disabled) {
|
|
187
|
+
state.state.playing = true;
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
state.state.playing = !state.state.playing;
|
|
191
|
+
if (state.videoElm) {
|
|
192
|
+
if (state.state.playing) {
|
|
137
193
|
try {
|
|
138
194
|
setTimeout(() => {
|
|
139
|
-
|
|
140
|
-
}, 200)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
195
|
+
state.videoElm.play();
|
|
196
|
+
}, 200);
|
|
197
|
+
state.videoElm.addEventListener("progress", () => {
|
|
198
|
+
getLoadTime();
|
|
199
|
+
});
|
|
200
|
+
state.videoElm.addEventListener("timeupdate", throttle(getPlayTime, 1e3));
|
|
201
|
+
state.videoElm.addEventListener("ended", playEnded);
|
|
202
|
+
emit("play", state.videoElm);
|
|
203
|
+
} catch (e) {
|
|
204
|
+
handleError();
|
|
145
205
|
}
|
|
146
|
-
else
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}, O = (s) => {
|
|
177
|
-
let i = s.changedTouches[0].pageX - e.progressBar.pos.left;
|
|
178
|
-
e.videoSet.progress.current = i;
|
|
179
|
-
let d = i / e.videoSet.progress.width;
|
|
180
|
-
e.videoElm.duration && M(d, e.videoElm.duration);
|
|
181
|
-
}, M = (s, n) => {
|
|
182
|
-
e.videoElm.currentTime = Math.floor(s * n);
|
|
183
|
-
}, V = () => {
|
|
184
|
-
e.state.isError = !1, u();
|
|
185
|
-
}, H = () => {
|
|
186
|
-
e.state.fullScreen ? (e.state.fullScreen = !1, document.webkitCancelFullScreen()) : (e.state.fullScreen = !0, e.videoElm.webkitRequestFullScreen());
|
|
206
|
+
} else {
|
|
207
|
+
state.videoElm.pause();
|
|
208
|
+
emit("pause", state.videoElm);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const timeFormat = (t) => {
|
|
213
|
+
var h = Math.floor(t / 3600);
|
|
214
|
+
if (h < 10) {
|
|
215
|
+
h = "0" + h;
|
|
216
|
+
}
|
|
217
|
+
var m = Math.floor(t % 3600 / 60);
|
|
218
|
+
if (m < 10) {
|
|
219
|
+
m = "0" + m;
|
|
220
|
+
}
|
|
221
|
+
var s = Math.round(t % 3600 % 60);
|
|
222
|
+
if (s < 10) {
|
|
223
|
+
s = "0" + s;
|
|
224
|
+
}
|
|
225
|
+
var str = "";
|
|
226
|
+
if (h != 0) {
|
|
227
|
+
str = h + ":" + m + ":" + s;
|
|
228
|
+
} else {
|
|
229
|
+
str = m + ":" + s;
|
|
230
|
+
}
|
|
231
|
+
return str;
|
|
232
|
+
};
|
|
233
|
+
const getLoadTime = () => {
|
|
234
|
+
if (state.videoSet.loaded)
|
|
235
|
+
state.videoSet.loaded = state.videoElm.buffered.end(0) / state.videoElm.duration * 100;
|
|
187
236
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
237
|
+
const getPlayTime = () => {
|
|
238
|
+
const percent = state.videoElm.currentTime / state.videoElm.duration;
|
|
239
|
+
state.videoSet.progress.current = Math.round(state.videoSet.progress.width * percent);
|
|
240
|
+
state.videoSet.totalTime = timeFormat(state.videoElm.duration);
|
|
241
|
+
state.videoSet.displayTime = timeFormat(state.videoElm.currentTime);
|
|
242
|
+
emit("time", state.videoSet.displayTime, state.videoSet.totalTime);
|
|
243
|
+
};
|
|
244
|
+
const playEnded = () => {
|
|
245
|
+
state.state.playing = false;
|
|
246
|
+
state.state.isEnd = true;
|
|
247
|
+
state.videoSet.displayTime = "00:00";
|
|
248
|
+
state.videoSet.progress.current = 0;
|
|
249
|
+
state.videoElm.currentTime = 0;
|
|
250
|
+
emit("playend", state.videoElm);
|
|
251
|
+
};
|
|
252
|
+
const handleError = () => {
|
|
253
|
+
state.state.isError = true;
|
|
254
|
+
};
|
|
255
|
+
const volumeHandle = () => {
|
|
256
|
+
state.state.vol = props.options.volume;
|
|
257
|
+
};
|
|
258
|
+
const handleMuted = () => {
|
|
259
|
+
state.state.isMuted = !state.state.isMuted;
|
|
260
|
+
state.videoElm.muted = state.state.isMuted;
|
|
261
|
+
};
|
|
262
|
+
const touchSlidSrart = () => {
|
|
263
|
+
};
|
|
264
|
+
const touchSlidMove = (e) => {
|
|
265
|
+
let currentX = e.targetTouches[0].pageX;
|
|
266
|
+
let offsetX = currentX - state.progressBar.pos.left;
|
|
267
|
+
if (offsetX <= 0) {
|
|
268
|
+
offsetX = 0;
|
|
269
|
+
}
|
|
270
|
+
if (offsetX >= state.videoSet.progress.width) {
|
|
271
|
+
offsetX = state.videoSet.progress.width;
|
|
272
|
+
}
|
|
273
|
+
state.videoSet.progress.current = offsetX;
|
|
274
|
+
let percent = state.videoSet.progress.current / state.videoSet.progress.width;
|
|
275
|
+
state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
|
|
276
|
+
};
|
|
277
|
+
const touchSlidEnd = (e) => {
|
|
278
|
+
let currentX = e.changedTouches[0].pageX;
|
|
279
|
+
let offsetX = currentX - state.progressBar.pos.left;
|
|
280
|
+
state.videoSet.progress.current = offsetX;
|
|
281
|
+
let percent = offsetX / state.videoSet.progress.width;
|
|
282
|
+
state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
|
|
283
|
+
};
|
|
284
|
+
const setPlayTime = (percent, totalTime) => {
|
|
285
|
+
state.videoElm.currentTime = Math.floor(percent * totalTime);
|
|
286
|
+
};
|
|
287
|
+
const retry = () => {
|
|
288
|
+
state.state.isError = false;
|
|
289
|
+
init();
|
|
290
|
+
};
|
|
291
|
+
const fullScreen = () => {
|
|
292
|
+
if (!state.state.fullScreen) {
|
|
293
|
+
state.state.fullScreen = true;
|
|
294
|
+
state.videoElm.webkitRequestFullScreen();
|
|
295
|
+
} else {
|
|
296
|
+
state.state.fullScreen = false;
|
|
297
|
+
document.webkitCancelFullScreen();
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
onMounted(() => {
|
|
301
|
+
init();
|
|
302
|
+
});
|
|
303
|
+
return __spreadProps(__spreadValues(__spreadValues({
|
|
304
|
+
root
|
|
305
|
+
}, toRefs(props)), toRefs(state)), {
|
|
306
|
+
handleError,
|
|
307
|
+
isDisabled,
|
|
308
|
+
play,
|
|
309
|
+
handleMuted,
|
|
310
|
+
touchSlidSrart,
|
|
311
|
+
touchSlidMove,
|
|
312
|
+
touchSlidEnd,
|
|
313
|
+
retry,
|
|
314
|
+
fullScreen,
|
|
315
|
+
translate
|
|
203
316
|
});
|
|
204
317
|
}
|
|
205
|
-
})
|
|
318
|
+
});
|
|
319
|
+
const _hoisted_1 = {
|
|
206
320
|
class: "nut-video",
|
|
207
321
|
ref: "videocon"
|
|
208
|
-
}
|
|
322
|
+
};
|
|
323
|
+
const _hoisted_2 = ["muted", "autoplay", "loop", "poster", "controls", "preload"];
|
|
324
|
+
const _hoisted_3 = ["src", "type"];
|
|
325
|
+
const _hoisted_4 = { class: "nut-video-controller__now" };
|
|
326
|
+
const _hoisted_5 = { class: "nut-video-controller__progress" };
|
|
327
|
+
const _hoisted_6 = {
|
|
209
328
|
class: "nut-video-controller__progress-value",
|
|
210
329
|
ref: "progressBar"
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
330
|
+
};
|
|
331
|
+
const _hoisted_7 = /* @__PURE__ */ createElementVNode("div", { class: "nut-video-controller__ball-move" }, null, -1);
|
|
332
|
+
const _hoisted_8 = [
|
|
333
|
+
_hoisted_7
|
|
334
|
+
];
|
|
335
|
+
const _hoisted_9 = {
|
|
214
336
|
class: "nut-video-controller__played",
|
|
215
337
|
ref: "playedBar"
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
338
|
+
};
|
|
339
|
+
const _hoisted_10 = { class: "nut-video-controller__total" };
|
|
340
|
+
const _hoisted_11 = { class: "nut-video-error" };
|
|
341
|
+
const _hoisted_12 = { class: "nut-video-error-tip" };
|
|
342
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
343
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
344
|
+
createElementVNode("video", {
|
|
220
345
|
ref: "root",
|
|
221
346
|
class: "nut-video-player",
|
|
222
|
-
muted:
|
|
223
|
-
autoplay:
|
|
224
|
-
loop:
|
|
225
|
-
poster:
|
|
226
|
-
controls:
|
|
227
|
-
preload:
|
|
228
|
-
onError:
|
|
347
|
+
muted: _ctx.options.muted,
|
|
348
|
+
autoplay: _ctx.options.autoplay,
|
|
349
|
+
loop: _ctx.options.loop,
|
|
350
|
+
poster: _ctx.options.poster,
|
|
351
|
+
controls: _ctx.options.controls,
|
|
352
|
+
preload: _ctx.options.preload,
|
|
353
|
+
onError: _cache[0] || (_cache[0] = (...args) => _ctx.handleError && _ctx.handleError(...args))
|
|
229
354
|
}, [
|
|
230
|
-
|
|
231
|
-
src:
|
|
232
|
-
type:
|
|
233
|
-
}, null, 8,
|
|
234
|
-
], 40,
|
|
235
|
-
|
|
355
|
+
createElementVNode("source", {
|
|
356
|
+
src: _ctx.source.src,
|
|
357
|
+
type: _ctx.source.type
|
|
358
|
+
}, null, 8, _hoisted_3)
|
|
359
|
+
], 40, _hoisted_2),
|
|
360
|
+
_ctx.showToolbox && !_ctx.isDisabled ? (openBlock(), createElementBlock("div", {
|
|
236
361
|
key: 0,
|
|
237
362
|
class: "nut-video-mask",
|
|
238
363
|
ref: "touchMask",
|
|
239
|
-
onClick:
|
|
240
|
-
}, null, 512)) :
|
|
241
|
-
|
|
364
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.play && _ctx.play(...args))
|
|
365
|
+
}, null, 512)) : createCommentVNode("", true),
|
|
366
|
+
_ctx.showToolbox && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("div", {
|
|
242
367
|
key: 1,
|
|
243
368
|
class: "nut-video-play-btn",
|
|
244
369
|
ref: "palyBtn",
|
|
245
|
-
onClick:
|
|
370
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.play && _ctx.play(...args))
|
|
246
371
|
}, null, 512)), [
|
|
247
|
-
[
|
|
248
|
-
]) :
|
|
249
|
-
|
|
250
|
-
class:
|
|
372
|
+
[vShow, !_ctx.state.playing]
|
|
373
|
+
]) : createCommentVNode("", true),
|
|
374
|
+
withDirectives(createElementVNode("div", {
|
|
375
|
+
class: normalizeClass(["nut-video-controller", { "nut-video-controller--show": !_ctx.state.playing, "nut-video-controller--hide": _ctx.state.playing }])
|
|
251
376
|
}, [
|
|
252
|
-
|
|
377
|
+
createElementVNode("div", {
|
|
253
378
|
class: "nut-video-controller__playbtn",
|
|
254
|
-
onClick:
|
|
379
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.play && _ctx.play(...args))
|
|
255
380
|
}),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
381
|
+
createElementVNode("div", _hoisted_4, toDisplayString(_ctx.videoSet.displayTime), 1),
|
|
382
|
+
createElementVNode("div", _hoisted_5, [
|
|
383
|
+
createElementVNode("div", _hoisted_6, [
|
|
384
|
+
createElementVNode("div", {
|
|
260
385
|
class: "buffered",
|
|
261
|
-
style:
|
|
386
|
+
style: normalizeStyle({ width: `${_ctx.videoSet.loaded}%` })
|
|
262
387
|
}, null, 4),
|
|
263
|
-
|
|
388
|
+
createElementVNode("div", {
|
|
264
389
|
class: "nut-video-controller__ball",
|
|
265
|
-
style:
|
|
266
|
-
transform: `translate3d(${
|
|
390
|
+
style: normalizeStyle({
|
|
391
|
+
transform: `translate3d(${_ctx.videoSet.progress.current}px, -50%, 0)`
|
|
267
392
|
}),
|
|
268
|
-
onTouchmove:
|
|
269
|
-
onTouchstart:
|
|
270
|
-
onTouchend:
|
|
271
|
-
},
|
|
272
|
-
|
|
393
|
+
onTouchmove: _cache[4] || (_cache[4] = withModifiers(($event) => _ctx.touchSlidMove($event), ["stop", "prevent"])),
|
|
394
|
+
onTouchstart: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.touchSlidSrart(), ["stop"])),
|
|
395
|
+
onTouchend: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.touchSlidEnd($event), ["stop"]))
|
|
396
|
+
}, _hoisted_8, 36),
|
|
397
|
+
createElementVNode("div", _hoisted_9, null, 512)
|
|
273
398
|
], 512)
|
|
274
399
|
]),
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
class:
|
|
278
|
-
onClick:
|
|
400
|
+
createElementVNode("div", _hoisted_10, toDisplayString(_ctx.videoSet.totalTime), 1),
|
|
401
|
+
createElementVNode("div", {
|
|
402
|
+
class: normalizeClass(["nut-video-controller__volume", { muted: _ctx.state.isMuted }]),
|
|
403
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleMuted && _ctx.handleMuted(...args))
|
|
279
404
|
}, null, 2),
|
|
280
|
-
|
|
405
|
+
createElementVNode("div", {
|
|
281
406
|
class: "nut-video-controller__full",
|
|
282
|
-
onClick:
|
|
407
|
+
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.fullScreen && _ctx.fullScreen(...args))
|
|
283
408
|
})
|
|
284
409
|
], 2), [
|
|
285
|
-
[
|
|
410
|
+
[vShow, _ctx.showToolbox && !_ctx.isDisabled]
|
|
286
411
|
]),
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
412
|
+
withDirectives(createElementVNode("div", _hoisted_11, [
|
|
413
|
+
createElementVNode("p", _hoisted_12, toDisplayString(_ctx.translate("errorTip")), 1),
|
|
414
|
+
createElementVNode("p", {
|
|
290
415
|
class: "nut-video-error-retry",
|
|
291
|
-
onClick:
|
|
292
|
-
},
|
|
416
|
+
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.retry && _ctx.retry(...args))
|
|
417
|
+
}, toDisplayString(_ctx.translate("clickRetry")), 1)
|
|
293
418
|
], 512), [
|
|
294
|
-
[
|
|
419
|
+
[vShow, _ctx.state.isError]
|
|
295
420
|
])
|
|
296
421
|
], 512);
|
|
297
422
|
}
|
|
298
|
-
const
|
|
423
|
+
const Video = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
299
424
|
export {
|
|
300
|
-
|
|
425
|
+
Video as default
|
|
301
426
|
};
|