VerifyModal.vue
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script lang="tsx">
import { defineComponent, ref, unref } from 'vue';
import { BasicModal } from '/@/components/Modal/index';
import { useTimeout } from '/@/hooks/core/useTimeout';
import { RotateDragVerify, DragVerifyActionType } from '/@/components/Verify/index';
export default defineComponent({
name: 'VerifyModal',
setup(_, { attrs, emit }) {
const dragRef = ref<DragVerifyActionType | null>(null);
function handleSuccess() {
useTimeout(() => {
emit('success');
const dragEl = unref(dragRef);
if (dragEl) {
dragEl.resume();
}
}, 500);
}
return () => (
<BasicModal
{...attrs}
title="安全校验"
keyboard={false}
maskClosable={false}
canFullscreen={false}
footer={null}
wrapperFooterOffset={60}
destroyOnClose={true}
>
<RotateDragVerify
imgWidth={210}
ref={dragRef}
text="请拖动滑块将图片摆正"
{...attrs}
onSuccess={handleSuccess}
/>
</BasicModal>
);
},
});
</script>