u
This commit is contained in:
commit
c570ec514c
550 files changed
+152597
No files matched your search
@@ -0,0 +1,13 @@
|
||||
// composables/useOnceMounted.ts
|
||||
import { onMounted, getCurrentInstance } from "vue";
|
||||
|
||||
export function useOnceMounted(callback: () => void) {
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const key = `__mounted_once_${instance?.type.__file || Math.random()}`;
|
||||
|
||||
if (!(window as any)[key]) {
|
||||
(window as any)[key] = true;
|
||||
onMounted(callback);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user