djledda.de main
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
504 B

  1. import { watchEffect, toValue, type MaybeRefOrGetter } from 'vue';
  2. import useDJSSRContext from "@/useDJSSRContext.ts";
  3. export default function useHead(params: {
  4. title: MaybeRefOrGetter<string>,
  5. }) {
  6. const context = useDJSSRContext();
  7. if (context) {
  8. context.head.title = params.title;
  9. } else {
  10. watchEffect(() => {
  11. const newTitle = toValue(params.title);
  12. if (newTitle) {
  13. document.title = newTitle;
  14. }
  15. });
  16. }
  17. }