feat(use): add useClickAway

This commit is contained in:
chenjiahan
2020-09-12 21:29:08 +08:00
parent a58da5570b
commit 195f3ffea1
8 changed files with 37 additions and 92 deletions
+2 -6
View File
@@ -1,7 +1,7 @@
import { ref, watch, computed, Teleport, Transition } from 'vue';
import { createNamespace } from '../utils';
import { stopPropagation } from '../utils/dom/event';
import { useClickOutside } from '../composition/use-click-outside';
import { useClickAway } from '@vant/use';
import Key from './Key';
const [createComponent, bem] = createNamespace('number-keyboard');
@@ -224,11 +224,7 @@ export default createComponent({
}
);
useClickOutside({
event: 'touchstart',
element: rootRef,
callback: onClose,
});
useClickAway(rootRef, onClose, { eventName: 'touchstart' });
return () => {
const Title = renderTitle();