index-C2merokO.mjs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { ref, watchEffect, watch, getCurrentInstance } from 'file://D:/zwj/nuxt/sannongzixunwang_web/node_modules/vue/index.mjs';
  2. import { i as injectHead, d as resolveUnrefHeadInput } from './server.mjs';
  3. import { composableNames } from 'file://D:/zwj/nuxt/sannongzixunwang_web/node_modules/@unhead/shared/dist/index.mjs';
  4. function useHead(input, options = {}) {
  5. const head = options.head || injectHead();
  6. if (head) {
  7. if (!head.ssr)
  8. return clientUseHead(head, input, options);
  9. return head.push(input, options);
  10. }
  11. }
  12. function clientUseHead(head, input, options = {}) {
  13. const deactivated = ref(false);
  14. const resolvedInput = ref({});
  15. watchEffect(() => {
  16. resolvedInput.value = deactivated.value ? {} : resolveUnrefHeadInput(input);
  17. });
  18. const entry = head.push(resolvedInput.value, options);
  19. watch(resolvedInput, (e) => {
  20. entry.patch(e);
  21. });
  22. getCurrentInstance();
  23. return entry;
  24. }
  25. const coreComposableNames = [
  26. "injectHead"
  27. ];
  28. ({
  29. "@unhead/vue": [...coreComposableNames, ...composableNames]
  30. });
  31. export { useHead as u };
  32. //# sourceMappingURL=index-C2merokO.mjs.map