PC-mj/.output/server/chunks/app/_nuxt/index-0ac4f71f.mjs

35 lines
979 B
JavaScript
Raw Normal View History

2024-01-09 07:55:02 +00:00
import { ref, watchEffect, watch, getCurrentInstance } from 'vue';
import { l as injectHead, r as resolveUnrefHeadInput } from '../server.mjs';
import { composableNames } from '@unhead/shared';
function useHead(input, options = {}) {
const head = options.head || injectHead();
if (head) {
if (!head.ssr)
return clientUseHead(head, input, options);
return head.push(input, options);
}
}
function clientUseHead(head, input, options = {}) {
const deactivated = ref(false);
const resolvedInput = ref({});
watchEffect(() => {
resolvedInput.value = deactivated.value ? {} : resolveUnrefHeadInput(input);
});
const entry = head.push(resolvedInput.value, options);
watch(resolvedInput, (e) => {
entry.patch(e);
});
getCurrentInstance();
return entry;
}
const coreComposableNames = [
"injectHead"
];
({
"@unhead/vue": [...coreComposableNames, ...composableNames]
});
2024-07-03 04:26:06 +00:00
export { useHead as u };
//# sourceMappingURL=index-0ac4f71f.mjs.map