mirror of
https://github.com/youzan/vant.git
synced 2025-10-16 16:04:04 +00:00
fix(@vant/use): invalid watch source (#9095)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Ref, unref, onUnmounted, onDeactivated, watch } from 'vue';
|
||||
import { Ref, watch, isRef, unref, onUnmounted, onDeactivated } from 'vue';
|
||||
import { onMountedOrActivated } from '../onMountedOrActivated';
|
||||
import { inBrowser } from '../utils';
|
||||
|
||||
@@ -65,8 +65,10 @@ export function useEventListener(
|
||||
onDeactivated(() => remove(target));
|
||||
onMountedOrActivated(() => add(target));
|
||||
|
||||
watch(target, (val, oldVal) => {
|
||||
remove(oldVal);
|
||||
add(val);
|
||||
});
|
||||
if (isRef(target)) {
|
||||
watch(target, (val, oldVal) => {
|
||||
remove(oldVal);
|
||||
add(val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user