11<template >
22 <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"
66 >
77 <div class =" gc-header" >
88 <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+ />
1015 </div >
1116 <div class =" gc-body" :style =" imageStyles" >
1217 <div class =" gc-loading" >
1318 <loading-icon />
1419 </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+ />
1628 <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 >
2141 </div >
2242 </div >
2343 <div class =" gc-footer" >
2444 <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+ />
2755 </div >
2856 <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 >
3061 </div >
3162 </div >
3263 </div >
3364</template >
3465
3566<script lang="ts" setup>
3667import {computed , reactive , toRaw , watch } from " vue"
37- import CloseIcon from " ../../assets/icons/close-icon.vue " ;
68+ import { ClickConfig , defaultConfig } from " ./meta/config " ;
3869
70+ import CloseIcon from " ../../assets/icons/close-icon.vue" ;
3971import RefreshIcon from " ../../assets/icons/refresh-icon.vue" ;
4072import LoadingIcon from " ../../assets/icons/loading-icon.vue" ;
4173
42- import {ClickConfig , defaultConfig } from " ./meta/config" ;
4374import {ClickData } from " ./meta/data" ;
4475import {ClickEvent } from " ./meta/event" ;
4576import {ClickExpose } from " ./meta/expose" ;
@@ -51,6 +82,7 @@ const props = withDefaults(
5182 config? : ClickConfig ;
5283 events? : ClickEvent ,
5384 data: ClickData ,
85+ [x : string ]: any ,
5486 }>(),
5587 {
5688 config: defaultConfig ,
@@ -76,7 +108,10 @@ watch(() => props.config, (newData, _) => {
76108 Object .assign (localConfig , newData )
77109},{ deep: true })
78110
79- const handler = useHandler (localData , localEvent );
111+ const handler = useHandler (localData , localEvent , () => {
112+ localData .thumb = ' '
113+ localData .image = ' '
114+ });
80115
81116const wrapperStyles = computed (() => {
82117 const hPadding = localConfig .horizontalPadding || 0
@@ -107,7 +142,7 @@ const imageStyles = computed(() => {
107142})
108143
109144const hasDisplayImageState = computed (() => {
110- return localData .image != ' ' && localData .thumb != ' '
145+ return localData .image != ' ' || localData .thumb != ' '
111146})
112147
113148const hasDisplayWrapperState = computed (() => {
@@ -117,8 +152,8 @@ const hasDisplayWrapperState = computed(() => {
117152defineExpose <ClickExpose >({
118153 reset: handler .resetData ,
119154 clear: handler .clearData ,
120- refresh: handler .refreshEvent ,
121- close: handler .closeEvent ,
155+ refresh: handler .refresh ,
156+ close: handler .close ,
122157});
123158 </script >
124159
@@ -151,7 +186,7 @@ defineExpose<ClickExpose>({
151186 -ms-flex-align :center ;
152187 align-items : center ;
153188 justify-content : center ;
154- border-radius : 20 px ;
189+ border-radius : 22 px ;
155190 cursor : default ;
156191 }
157192 }
0 commit comments