@mixd-id/web-scaffold 0.1.2301231343 → 0.1.2301231344
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
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<div :class="$style.inner">
|
|
4
4
|
<span v-if="images && images.length && images.length > 0" v-for="image in images" :key="image">
|
|
5
5
|
<a v-if="image.target && image.target.indexOf('://') >= 0" :href="image.target" @click="checkClick">
|
|
6
|
-
<Image :src="image.imageUrl" :
|
|
6
|
+
<Image :src="image.imageUrl" :class="imageClass" />
|
|
7
7
|
</a>
|
|
8
8
|
<router-link v-if="image.target" :to="scrolling ? '' : image.target">
|
|
9
|
-
<Image :src="image.imageUrl" :
|
|
9
|
+
<Image :src="image.imageUrl" :class="imageClass"/>
|
|
10
10
|
</router-link>
|
|
11
|
-
<Image v-else :src="image.imageUrl" :
|
|
11
|
+
<Image v-else :src="image.imageUrl" :class="imageClass" />
|
|
12
12
|
</span>
|
|
13
13
|
<div v-else :class="imageClass" class="bg-gray-200 animate-pulse"></div>
|
|
14
14
|
</div>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<slot v-if="display >= 4 && $slots.day" name="day" :day="day"></slot>
|
|
5
|
+
<div v-else-if="display >= 4" :class="$style.lap"></div>
|
|
6
|
+
|
|
7
|
+
<slot v-if="display >= 3 && $slots.hour" name="hour" :hour="hour"></slot>
|
|
8
|
+
<div v-else-if="display >= 3" :class="$style.lap">{{ hour }}</div>
|
|
9
|
+
|
|
10
|
+
<slot v-if="display >= 2 && $slots.minute" name="minute" :minute="minute"></slot>
|
|
11
|
+
<div v-else-if="display >= 2" :class="$style.lap">{{ minute }}</div>
|
|
12
|
+
|
|
13
|
+
<slot v-if="display >= 1 && $slots.second" name="second" :second="second"></slot>
|
|
14
|
+
<div ref="second" v-else-if="display >= 1" :class="$style.lap">
|
|
15
|
+
<div>23</div>
|
|
16
|
+
<div>21</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<button @click="tick">Tick</button>
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
|
|
26
|
+
import debounce from "lodash/debounce";
|
|
27
|
+
|
|
28
|
+
export default{
|
|
29
|
+
|
|
30
|
+
props: {
|
|
31
|
+
|
|
32
|
+
display: {
|
|
33
|
+
type: [ String, Number ], // default: 3
|
|
34
|
+
default: 3
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
value: [ String, Number ] // value in second
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
computed:{
|
|
42
|
+
|
|
43
|
+
day(){
|
|
44
|
+
return Math.floor(this.timer / 86400).toString().padStart(2, '0')
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
hour(){
|
|
48
|
+
return (Math.floor(this.timer / 3600) % 24).toString().padStart(2, '0')
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
minute(){
|
|
52
|
+
return (Math.floor(this.timer / 60) % 60).toString().padStart(2, '0')
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
second(){
|
|
56
|
+
return (this.timer % 60).toString().padStart(2, '0')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
data(){
|
|
62
|
+
return {
|
|
63
|
+
timer: null,
|
|
64
|
+
timeoutId: null,
|
|
65
|
+
beforeSecond: null,
|
|
66
|
+
afterSecond: null
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
mounted() {
|
|
71
|
+
this.start()
|
|
72
|
+
|
|
73
|
+
this.$refs.second.addEventListener('transitionend', this.onTransitionEnd)
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
methods: {
|
|
77
|
+
|
|
78
|
+
onTransitionEnd: debounce(function (e){
|
|
79
|
+
/*console.log('onTransitionEnd', e.propertyName)
|
|
80
|
+
console.log(this.$refs.second.childNodes[1])
|
|
81
|
+
console.log(this.$refs.second.childNodes[0])*/
|
|
82
|
+
this.$refs.second.insertBefore(this.$refs.second.childNodes[1], this.$refs.second.childNodes[0])
|
|
83
|
+
this.$refs.second.classList.remove(this.$style.tick)
|
|
84
|
+
this.$refs.second.childNodes[0].innerHTML = ''
|
|
85
|
+
}, 100),
|
|
86
|
+
|
|
87
|
+
start(){
|
|
88
|
+
|
|
89
|
+
this.timer = this.value
|
|
90
|
+
this.timeoutId = window.setInterval(() => {
|
|
91
|
+
this.timer--
|
|
92
|
+
|
|
93
|
+
if(this.timer <= 0){
|
|
94
|
+
window.clearTimeout(this.timeoutId)
|
|
95
|
+
}
|
|
96
|
+
}, 1000)
|
|
97
|
+
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
tick(){
|
|
101
|
+
this.$refs.second.classList.add(this.$style.tick)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
watch: {
|
|
107
|
+
|
|
108
|
+
value(to){
|
|
109
|
+
this.start()
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
second(to, from){
|
|
113
|
+
this.$refs.second.firstElementChild.innerHTML = to
|
|
114
|
+
this.$refs.second.lastElementChild.innerHTML = from
|
|
115
|
+
this.tick()
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style module>
|
|
124
|
+
|
|
125
|
+
.comp{
|
|
126
|
+
@apply flex flex-row gap-2;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.lap{
|
|
130
|
+
@apply relative overflow-hidden w-[1.5rem];
|
|
131
|
+
}
|
|
132
|
+
.lap>*{
|
|
133
|
+
}
|
|
134
|
+
.lap>*:first-child{
|
|
135
|
+
@apply absolute top-0 left-0;
|
|
136
|
+
transform: translate3d(0, -1rem, 0);
|
|
137
|
+
}
|
|
138
|
+
.lap>*:last-child{
|
|
139
|
+
transform: translate3d(0, 0, 0);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.tick{
|
|
143
|
+
}
|
|
144
|
+
.tick>*{
|
|
145
|
+
transition: transform 300ms ease;
|
|
146
|
+
}
|
|
147
|
+
.tick>*:first-child{
|
|
148
|
+
transform: translate3d(0, 0, 0);
|
|
149
|
+
}
|
|
150
|
+
.tick>*:last-child{
|
|
151
|
+
transform: translate3d(0, 1rem, 0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<div class="absolute top-0 right-0 bg-black/50 rounded-lg flex flex-row gap-2 items-center m-1">
|
|
5
|
+
<button type="button" class="p-1" @click="prev">Prev</button>
|
|
6
|
+
<button type="button" class="p-1" @click="next">Next</button>
|
|
7
|
+
<button type="button" class="p-1" @click="toggleMode" :class="mode === 1 ? 'bg-red-500' : 'bg-green-500'">360</button>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<img v-if="mode === 1" :src="staticSrc" class="pointer-events-none" style="user-select: none" />
|
|
11
|
+
<div v-else-if="mode === 2 && status === 1">Loading...</div>
|
|
12
|
+
<div v-else-if="mode === 2 && status === 2">
|
|
13
|
+
<img v-for="(path, idx) in src" :src="path" :class="idx === index ? '' : 'hidden'"
|
|
14
|
+
class="pointer-events-none" style="user-select: none"/>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
|
|
21
|
+
export default{
|
|
22
|
+
|
|
23
|
+
props: {
|
|
24
|
+
|
|
25
|
+
src: Array,
|
|
26
|
+
|
|
27
|
+
staticSrc: String
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
data(){
|
|
32
|
+
return {
|
|
33
|
+
status: 0,
|
|
34
|
+
index: 0,
|
|
35
|
+
mode: 1,
|
|
36
|
+
startX: null
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
mounted(){
|
|
41
|
+
this.load()
|
|
42
|
+
|
|
43
|
+
this.$el.addEventListener('mousedown', this.onMouseDown)
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
methods: {
|
|
47
|
+
|
|
48
|
+
load(){
|
|
49
|
+
|
|
50
|
+
this.status = 1
|
|
51
|
+
let loadedCount = 0
|
|
52
|
+
|
|
53
|
+
const loadComplete = () => {
|
|
54
|
+
loadedCount++
|
|
55
|
+
|
|
56
|
+
if(loadedCount >= this.src.length){
|
|
57
|
+
this.status = 2
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.src.forEach((src) => {
|
|
62
|
+
var img = new Image()
|
|
63
|
+
img.addEventListener('load', () => {
|
|
64
|
+
loadComplete()
|
|
65
|
+
})
|
|
66
|
+
img.addEventListener('error', () => {
|
|
67
|
+
loadComplete()
|
|
68
|
+
})
|
|
69
|
+
img.src = src
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
prev(){
|
|
75
|
+
this.index--
|
|
76
|
+
if(this.index < 0)
|
|
77
|
+
this.index = this.src.length - 1
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
next(){
|
|
81
|
+
this.index++
|
|
82
|
+
if(this.index >= this.src.length)
|
|
83
|
+
this.index = 0
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
toggleMode(){
|
|
87
|
+
this.mode = this.mode === 1 ? 2 : 1
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
onMouseMove(e){
|
|
91
|
+
const curX = e.touches ? e.touches[0].clientX : e.clientX
|
|
92
|
+
const distance = curX - this.startX
|
|
93
|
+
if(distance > 5){
|
|
94
|
+
this.next()
|
|
95
|
+
this.startX = curX
|
|
96
|
+
}
|
|
97
|
+
else if(distance < -5){
|
|
98
|
+
this.prev()
|
|
99
|
+
this.startX = curX
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
onMouseUp(){
|
|
104
|
+
window.removeEventListener('mousemove', this.onMouseMove)
|
|
105
|
+
window.removeEventListener('mouseup', this.onMouseUp)
|
|
106
|
+
this.startX = null
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
onMouseDown(e){
|
|
110
|
+
|
|
111
|
+
if(this.mode !== 2) return
|
|
112
|
+
|
|
113
|
+
this.startX = e.touches ? e.touches[0].clientX : e.clientX
|
|
114
|
+
window.addEventListener('mousemove', this.onMouseMove)
|
|
115
|
+
window.addEventListener('mouseup', this.onMouseUp)
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
watch: {
|
|
122
|
+
|
|
123
|
+
src(to){
|
|
124
|
+
console.log('src', to)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<style module>
|
|
135
|
+
|
|
136
|
+
.comp{
|
|
137
|
+
@apply relative;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -156,6 +156,7 @@ export default{
|
|
|
156
156
|
app.component('ChatTyping', defineAsyncComponent(() => import("./components/ChatTyping.vue")))
|
|
157
157
|
app.component('Checkbox', defineAsyncComponent(() => import("./components/Checkbox.vue")))
|
|
158
158
|
app.component('CopyToClipboard', defineAsyncComponent(() => import("./components/CopyToClipboard.vue")))
|
|
159
|
+
app.component('Countdown', defineAsyncComponent(() => import("./components/Countdown.vue")))
|
|
159
160
|
app.component('Dropdown', defineAsyncComponent(() => import("./components/Dropdown.vue")))
|
|
160
161
|
app.component('Datepicker', defineAsyncComponent(() => import("./components/Datepicker.vue")))
|
|
161
162
|
app.component('ErrorText', defineAsyncComponent(() => import("./components/ErrorText.vue")))
|
|
@@ -164,6 +165,7 @@ export default{
|
|
|
164
165
|
app.component('Ahref', defineAsyncComponent(() => import("./components/Ahref.vue")))
|
|
165
166
|
app.component('Switch', defineAsyncComponent(() => import("./components/Switch.vue")))
|
|
166
167
|
app.component('Image', defineAsyncComponent(() => import("./components/Image.vue")))
|
|
168
|
+
app.component('Image360', defineAsyncComponent(() => import("./components/Image360.vue")))
|
|
167
169
|
app.component('ImagePreview', defineAsyncComponent(() => import("./components/ImagePreview.vue")))
|
|
168
170
|
app.component('ImageFullScreen', defineAsyncComponent(() => import("./components/ImageFullScreen.vue")))
|
|
169
171
|
app.component('ImportModal', defineAsyncComponent(() => import("./components/ImportModal.vue")))
|