基于vue3.0和element-plus的组件库
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
import { nextTick, Ref, watchEffect, WatchEffect } from "vue"; |
|
|
|
export function watchEffectOnce(cond: Ref<any, any>, cb: WatchEffect) { |
|
const stop = watchEffect((onCleanup) => { |
|
if (cond.value) { |
|
nextTick(() => stop()); |
|
cb(onCleanup); |
|
} |
|
}); |
|
|
|
return stop; |
|
}
|
|
|