1
1
<template >
2
2
<div
3
- :class =" `go-captcha gc-wrapper ${localConfig.showTheme && 'gc-theme'}`"
4
- :style =" wrapperStyles"
5
- v-show =" hasDisplayWrapperState"
3
+ :class =" `go-captcha gc-wrapper ${localConfig.showTheme && 'gc-theme'}`"
4
+ :style =" wrapperStyles"
5
+ v-show =" hasDisplayWrapperState"
6
6
>
7
7
<div class =" gc-header" >
8
8
<span >{{ localConfig.title }}</span >
9
- <img v-show =" hasDisplayImageState" :style =" thumbStyles" :src =" localData.thumb" alt =" " />
9
+ <img
10
+ v-show =" hasDisplayImageState"
11
+ :style =" thumbStyles"
12
+ :src =" localData.thumb"
13
+ alt =" "
14
+ />
10
15
</div >
11
16
<div class =" gc-body" :style =" imageStyles" >
12
17
<div class =" gc-loading" >
13
18
<loading-icon />
14
19
</div >
15
- <img :style =" imageStyles" v-show =" hasDisplayImageState" class =" gc-picture" :src =" localData.image" alt =" " @click =" handler.clickEvent" />
20
+ <img
21
+ :style =" imageStyles"
22
+ v-show =" hasDisplayImageState"
23
+ class =" gc-picture"
24
+ :src =" localData.image"
25
+ @click =" handler.clickEvent"
26
+ alt =" "
27
+ />
16
28
<div class =" gc-dots" >
17
- <div class =" gc-dot" v-for =" dot in handler.dots.list" :key =" `${dot.key + '-' + dot.index}`" :style =" {
18
- top: (dot.y - ((localConfig.dotSize || 1)/2)-1) + 'px',
19
- left: (dot.x - ((localConfig.dotSize || 1)/2)-1) + 'px',
20
- }" >{{dot.index}}</div >
29
+ <div
30
+ class =" gc-dot"
31
+ v-for =" dot in handler.dots.list"
32
+ :key =" `${dot.key + '-' + dot.index}`"
33
+ :style =" {
34
+ width: localConfig.dotSize + 'px',
35
+ height: localConfig.dotSize + 'px',
36
+ borderRadius: localConfig.dotSize + 'px',
37
+ top: (dot.y - ((localConfig.dotSize || 1)/2)-1) + 'px',
38
+ left: (dot.x - ((localConfig.dotSize || 1)/2)-1) + 'px',
39
+ }"
40
+ >{{dot.index}}</div >
21
41
</div >
22
42
</div >
23
43
<div class =" gc-footer" >
24
44
<div class =" gc-icon-block gc-icon-block2" >
25
- <close-icon :width =" localConfig.iconSize" :height =" localConfig.iconSize" @click =" handler.closeEvent" />
26
- <refresh-icon :width =" localConfig.iconSize" :height =" localConfig.iconSize" @click =" handler.refreshEvent" />
45
+ <close-icon
46
+ :width =" localConfig.iconSize"
47
+ :height =" localConfig.iconSize"
48
+ @click =" handler.closeEvent"
49
+ />
50
+ <refresh-icon
51
+ :width =" localConfig.iconSize"
52
+ :height =" localConfig.iconSize"
53
+ @click =" handler.refreshEvent"
54
+ />
27
55
</div >
28
56
<div class =" gc-button-block" >
29
- <button :class =" !hasDisplayImageState && 'disabled'" @click =" handler.confirmEvent" >{{ localConfig.buttonText }}</button >
57
+ <button
58
+ :class =" !hasDisplayImageState && 'disabled'"
59
+ @click =" handler.confirmEvent"
60
+ >{{ localConfig.buttonText }}</button >
30
61
</div >
31
62
</div >
32
63
</div >
33
64
</template >
34
65
35
66
<script lang="ts" setup>
36
67
import {computed , reactive , toRaw , watch } from " vue"
37
- import CloseIcon from " ../../assets/icons/close-icon.vue " ;
68
+ import { ClickConfig , defaultConfig } from " ./meta/config " ;
38
69
70
+ import CloseIcon from " ../../assets/icons/close-icon.vue" ;
39
71
import RefreshIcon from " ../../assets/icons/refresh-icon.vue" ;
40
72
import LoadingIcon from " ../../assets/icons/loading-icon.vue" ;
41
73
42
- import {ClickConfig , defaultConfig } from " ./meta/config" ;
43
74
import {ClickData } from " ./meta/data" ;
44
75
import {ClickEvent } from " ./meta/event" ;
45
76
import {ClickExpose } from " ./meta/expose" ;
@@ -51,6 +82,7 @@ const props = withDefaults(
51
82
config? : ClickConfig ;
52
83
events? : ClickEvent ,
53
84
data: ClickData ,
85
+ [x : string ]: any ,
54
86
}>(),
55
87
{
56
88
config: defaultConfig ,
@@ -76,7 +108,10 @@ watch(() => props.config, (newData, _) => {
76
108
Object .assign (localConfig , newData )
77
109
},{ deep: true })
78
110
79
- const handler = useHandler (localData , localEvent );
111
+ const handler = useHandler (localData , localEvent , () => {
112
+ localData .thumb = ' '
113
+ localData .image = ' '
114
+ });
80
115
81
116
const wrapperStyles = computed (() => {
82
117
const hPadding = localConfig .horizontalPadding || 0
@@ -107,7 +142,7 @@ const imageStyles = computed(() => {
107
142
})
108
143
109
144
const hasDisplayImageState = computed (() => {
110
- return localData .image != ' ' && localData .thumb != ' '
145
+ return localData .image != ' ' || localData .thumb != ' '
111
146
})
112
147
113
148
const hasDisplayWrapperState = computed (() => {
@@ -117,8 +152,8 @@ const hasDisplayWrapperState = computed(() => {
117
152
defineExpose <ClickExpose >({
118
153
reset: handler .resetData ,
119
154
clear: handler .clearData ,
120
- refresh: handler .refreshEvent ,
121
- close: handler .closeEvent ,
155
+ refresh: handler .refresh ,
156
+ close: handler .close ,
122
157
});
123
158
</script >
124
159
@@ -151,7 +186,7 @@ defineExpose<ClickExpose>({
151
186
-ms-flex-align :center ;
152
187
align-items : center ;
153
188
justify-content : center ;
154
- border-radius : 20 px ;
189
+ border-radius : 22 px ;
155
190
cursor : default ;
156
191
}
157
192
}
0 commit comments