1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 10:54:44 +00:00

fix(packages/vue): set render duration ref only after mounted and updated

This commit is contained in:
2025-05-09 13:11:20 +07:00
parent 3a2837c1a1
commit 8d6f08c332

View File

@@ -22,9 +22,13 @@ import { getLifeCycleTarger } from '../..';
export function useRenderInfo(instance?: ComponentInternalInstance) {
const target = getLifeCycleTarger(instance);
const duration = ref(0);
let startTime = 0;
const startMark = () => duration.value = performance.now();
const endMark = () => duration.value = Math.max(performance.now() - duration.value, 0);
const startMark = () => startTime = performance.now();
const endMark = () => {
duration.value = Math.max(performance.now() - startTime, 0);
startTime = 0;
};
onBeforeMount(startMark, target);
onMounted(endMark, target);