@mixd-id/web-scaffold 0.1.230406216 → 0.1.230406218
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/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="$style.comp" :style="computedStyle">
|
|
2
|
+
<div :class="$style.comp" :style="computedStyle" @click="!ready ? loadVideo() : null">
|
|
3
3
|
<div :class="videoClass" class="absolute top-0 left-0 right-0 bottom-0 z-10"
|
|
4
4
|
:style="{ opacity:ready ? 1 : 0 }">
|
|
5
|
-
<div id="
|
|
5
|
+
<div :id="id"></div>
|
|
6
6
|
</div>
|
|
7
7
|
<div :class="videoClass" class="relative flex items-center justify-center"
|
|
8
8
|
:style="thumbnailStyle">
|
|
9
|
-
<button class="w-[68px] h-[48px]"
|
|
9
|
+
<button class="w-[68px] h-[48px]">
|
|
10
10
|
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%">
|
|
11
11
|
<path class="ytp-large-play-button-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#333"></path>
|
|
12
12
|
<path d="M 45,24 27,14 27,34" fill="#fff"></path>
|
|
@@ -20,6 +20,33 @@
|
|
|
20
20
|
|
|
21
21
|
import { componentMixin } from '../mixin/component'
|
|
22
22
|
|
|
23
|
+
const callbacks = []
|
|
24
|
+
const initScript = (callback, id) => {
|
|
25
|
+
|
|
26
|
+
callbacks.push([ callback, id ])
|
|
27
|
+
|
|
28
|
+
let script = document.getElementById('youtube-iframe-api')
|
|
29
|
+
if(!script){
|
|
30
|
+
window.onYouTubeIframeAPIReady = () => {
|
|
31
|
+
while(callbacks.length > 0){
|
|
32
|
+
const [ callback, id ] = callbacks.pop()
|
|
33
|
+
callback()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const script = document.createElement('script')
|
|
38
|
+
script.src = 'https://www.youtube.com/iframe_api'
|
|
39
|
+
script.id = 'youtube-iframe-api'
|
|
40
|
+
document.head.appendChild(script)
|
|
41
|
+
}
|
|
42
|
+
else{
|
|
43
|
+
while(callbacks.length > 0){
|
|
44
|
+
const [ callback, id ] = callbacks.pop()
|
|
45
|
+
callback()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
23
50
|
export default{
|
|
24
51
|
|
|
25
52
|
mixins: [ componentMixin ],
|
|
@@ -29,7 +56,7 @@ export default{
|
|
|
29
56
|
videoId: String,
|
|
30
57
|
|
|
31
58
|
delay: {
|
|
32
|
-
type: Number,
|
|
59
|
+
type: [ Number, String ],
|
|
33
60
|
default: 0
|
|
34
61
|
},
|
|
35
62
|
|
|
@@ -62,16 +89,15 @@ export default{
|
|
|
62
89
|
data(){
|
|
63
90
|
return {
|
|
64
91
|
ready: false,
|
|
65
|
-
player: null
|
|
92
|
+
player: null,
|
|
93
|
+
id: null
|
|
66
94
|
}
|
|
67
95
|
},
|
|
68
96
|
|
|
69
97
|
mounted() {
|
|
70
|
-
|
|
71
|
-
this.loadVideo()
|
|
72
|
-
}
|
|
98
|
+
this.id = this.uniqid()
|
|
73
99
|
|
|
74
|
-
if(parseInt(this.delay) > 0){
|
|
100
|
+
/*if(parseInt(this.delay) > 0){
|
|
75
101
|
window.setTimeout(() => {
|
|
76
102
|
if(!this.ready){
|
|
77
103
|
this.loadVideo()
|
|
@@ -84,21 +110,16 @@ export default{
|
|
|
84
110
|
this.loadVideo()
|
|
85
111
|
}
|
|
86
112
|
})
|
|
87
|
-
}
|
|
113
|
+
}*/
|
|
88
114
|
},
|
|
89
115
|
|
|
90
116
|
methods: {
|
|
91
117
|
|
|
92
118
|
loadVideo(){
|
|
93
119
|
|
|
94
|
-
|
|
95
|
-
const script = document.createElement('script')
|
|
96
|
-
script.src = 'https://www.youtube.com/iframe_api'
|
|
97
|
-
document.head.appendChild(script)
|
|
98
|
-
}
|
|
99
|
-
else{
|
|
120
|
+
initScript(() => {
|
|
100
121
|
if(!this.player){
|
|
101
|
-
this.player = new YT.Player(
|
|
122
|
+
this.player = new YT.Player(this.id, {
|
|
102
123
|
height: '100%',
|
|
103
124
|
width: '100%',
|
|
104
125
|
videoId: this.videoId,
|
|
@@ -116,7 +137,7 @@ export default{
|
|
|
116
137
|
else{
|
|
117
138
|
this.player.loadVideoById(this.videoId)
|
|
118
139
|
}
|
|
119
|
-
}
|
|
140
|
+
}, this.id)
|
|
120
141
|
|
|
121
142
|
}
|
|
122
143
|
|
package/src/mixin/component.js
CHANGED
|
@@ -153,7 +153,7 @@ export default{
|
|
|
153
153
|
|
|
154
154
|
compStyle(){
|
|
155
155
|
return {
|
|
156
|
-
'min-height': this.
|
|
156
|
+
'min-height': this.formHeight
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -164,7 +164,7 @@ export default{
|
|
|
164
164
|
form: {},
|
|
165
165
|
completed: false,
|
|
166
166
|
state: 1,
|
|
167
|
-
|
|
167
|
+
formHeight: undefined,
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
|
|
@@ -174,7 +174,7 @@ export default{
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
window.setTimeout(() => {
|
|
177
|
-
this.
|
|
177
|
+
this.formHeight = this.$el.clientHeight + 'px'
|
|
178
178
|
}, 1000)
|
|
179
179
|
}
|
|
180
180
|
|