refactor(SwipeCell): refactor with composition api

This commit is contained in:
chenjiahan
2020-09-08 17:30:18 +08:00
parent 3cd15b6124
commit b17c67ab53
2 changed files with 151 additions and 172 deletions

View File

@@ -1,6 +1,8 @@
import { on, off } from '../utils/dom/event';
import {
Ref,
ref,
isRef,
watch,
onMounted,
onActivated,
@@ -17,6 +19,10 @@ export function useGlobalEvent(
) {
let binded: boolean;
if (!isRef(target)) {
target = ref(target);
}
function add() {
if (binded || (flag && !flag.value) || !target.value) {
return;