fix: add an extra condition for tryOnMounted method

pull/6454/head
cmdltt@mail.ru 2024-09-22 20:59:04 +03:00
parent c0ed5f22bc
commit de87099773
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ import { isClient, isExist, setAttribute, setAttributes } from '@primeuix/utils/
import { getCurrentInstance, nextTick, onMounted, readonly, ref, watch } from 'vue';
function tryOnMounted(fn, sync = true) {
if (getCurrentInstance()) onMounted(fn);
if (getCurrentInstance() && getCurrentInstance().components) onMounted(fn);
else if (sync) fn();
else nextTick(fn);
}