Commit 32d64dbe816a0afda6ee9e91863199afb3e7b48e

Authored by 无木
1 parent 8b4b767f

fix(img-rotate-drag-verify): fix `resume` method support

修复ImgRotateDragVerify组件的resume方法无效的问题

fixed: #946
CHANGELOG.zh_CN.md
1 ### 🐛 Bug Fixes 1 ### 🐛 Bug Fixes
2 2
3 - **ApiTreeSelect** 修复未能正确监听`params`变化的问题 3 - **ApiTreeSelect** 修复未能正确监听`params`变化的问题
4 -- **BasicTable** 修复可编辑单元格不支持 ellipsis 配置的问题 4 +- **BasicTable** 修复可编辑单元格不支持`ellipsis`配置的问题
  5 +- **ImgRotateDragVerify** 修复组件`resume`方法无法调用的问题
5 6
6 ## 2.6.1(2021-07-19) 7 ## 2.6.1(2021-07-19)
7 8
src/components/Verify/src/ImgRotate.vue
1 <script lang="tsx"> 1 <script lang="tsx">
2 import type { MoveData, DragVerifyActionType } from './typing'; 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 import { useTimeoutFn } from '/@/hooks/core/useTimeout'; 4 import { useTimeoutFn } from '/@/hooks/core/useTimeout';
5 import BasicDragVerify from './DragVerify.vue'; 5 import BasicDragVerify from './DragVerify.vue';
6 import { hackCss } from '/@/utils/domUtils'; 6 import { hackCss } from '/@/utils/domUtils';
@@ -8,11 +8,11 @@ @@ -8,11 +8,11 @@
8 import { useI18n } from '/@/hooks/web/useI18n'; 8 import { useI18n } from '/@/hooks/web/useI18n';
9 9
10 export default defineComponent({ 10 export default defineComponent({
11 - name: 'ImgRotateDargVerify', 11 + name: 'ImgRotateDragVerify',
12 inheritAttrs: false, 12 inheritAttrs: false,
13 props: rotateProps, 13 props: rotateProps,
14 emits: ['success', 'change', 'update:value'], 14 emits: ['success', 'change', 'update:value'],
15 - setup(props, { emit, attrs }) { 15 + setup(props, { emit, attrs, expose }) {
16 const basicRef = ref<Nullable<DragVerifyActionType>>(null); 16 const basicRef = ref<Nullable<DragVerifyActionType>>(null);
17 const state = reactive({ 17 const state = reactive({
18 showTip: false, 18 showTip: false,
@@ -112,10 +112,8 @@ @@ -112,10 +112,8 @@
112 handleImgOnLoad(); 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 // handleImgOnLoad(); 117 // handleImgOnLoad();
120 return () => { 118 return () => {
121 const { src } = props; 119 const { src } = props;
@@ -138,6 +136,7 @@ @@ -138,6 +136,7 @@
138 onClick={() => { 136 onClick={() => {
139 resume(); 137 resume();
140 }} 138 }}
  139 + alt="verify"
141 /> 140 />
142 {state.showTip && ( 141 {state.showTip && (
143 <span class={[`ir-dv-img__tip`, state.isPassing ? 'success' : 'error']}> 142 <span class={[`ir-dv-img__tip`, state.isPassing ? 'success' : 'error']}>