Commit 32d64dbe816a0afda6ee9e91863199afb3e7b48e
1 parent
8b4b767f
fix(img-rotate-drag-verify): fix `resume` method support
修复ImgRotateDragVerify组件的resume方法无效的问题 fixed: #946
Showing
2 changed files
with
8 additions
and
8 deletions
CHANGELOG.zh_CN.md
src/components/Verify/src/ImgRotate.vue
1 | 1 | <script lang="tsx"> |
2 | 2 | import type { MoveData, DragVerifyActionType } from './typing'; |
3 | - import { defineComponent, computed, unref, reactive, watch, ref, getCurrentInstance } from 'vue'; | |
3 | + import { defineComponent, computed, unref, reactive, watch, ref } from 'vue'; | |
4 | 4 | import { useTimeoutFn } from '/@/hooks/core/useTimeout'; |
5 | 5 | import BasicDragVerify from './DragVerify.vue'; |
6 | 6 | import { hackCss } from '/@/utils/domUtils'; |
... | ... | @@ -8,11 +8,11 @@ |
8 | 8 | import { useI18n } from '/@/hooks/web/useI18n'; |
9 | 9 | |
10 | 10 | export default defineComponent({ |
11 | - name: 'ImgRotateDargVerify', | |
11 | + name: 'ImgRotateDragVerify', | |
12 | 12 | inheritAttrs: false, |
13 | 13 | props: rotateProps, |
14 | 14 | emits: ['success', 'change', 'update:value'], |
15 | - setup(props, { emit, attrs }) { | |
15 | + setup(props, { emit, attrs, expose }) { | |
16 | 16 | const basicRef = ref<Nullable<DragVerifyActionType>>(null); |
17 | 17 | const state = reactive({ |
18 | 18 | showTip: false, |
... | ... | @@ -112,10 +112,8 @@ |
112 | 112 | handleImgOnLoad(); |
113 | 113 | } |
114 | 114 | |
115 | - const instance = getCurrentInstance() as any; | |
116 | - if (instance) { | |
117 | - instance.resume = resume; | |
118 | - } | |
115 | + expose({ resume }); | |
116 | + | |
119 | 117 | // handleImgOnLoad(); |
120 | 118 | return () => { |
121 | 119 | const { src } = props; |
... | ... | @@ -138,6 +136,7 @@ |
138 | 136 | onClick={() => { |
139 | 137 | resume(); |
140 | 138 | }} |
139 | + alt="verify" | |
141 | 140 | /> |
142 | 141 | {state.showTip && ( |
143 | 142 | <span class={[`ir-dv-img__tip`, state.isPassing ? 'success' : 'error']}> | ... | ... |