fix: add an extra condition for tryOnMounted method
parent
c0ed5f22bc
commit
de87099773
|
@ -6,7 +6,7 @@ import { isClient, isExist, setAttribute, setAttributes } from '@primeuix/utils/
|
||||||
import { getCurrentInstance, nextTick, onMounted, readonly, ref, watch } from 'vue';
|
import { getCurrentInstance, nextTick, onMounted, readonly, ref, watch } from 'vue';
|
||||||
|
|
||||||
function tryOnMounted(fn, sync = true) {
|
function tryOnMounted(fn, sync = true) {
|
||||||
if (getCurrentInstance()) onMounted(fn);
|
if (getCurrentInstance() && getCurrentInstance().components) onMounted(fn);
|
||||||
else if (sync) fn();
|
else if (sync) fn();
|
||||||
else nextTick(fn);
|
else nextTick(fn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue