12 lines
No EOL
310 B
TypeScript
12 lines
No EOL
310 B
TypeScript
import { computed, watchEffect } from 'vue'
|
|
import { setTitle } from '@/helpers/setTitle'
|
|
|
|
import { ComputedGetter } from '@vue/reactivity'
|
|
|
|
export function useTitle(titleGetter: ComputedGetter<string>) {
|
|
const titleRef = computed(titleGetter)
|
|
|
|
watchEffect(() => setTitle(titleRef.value))
|
|
|
|
return titleRef
|
|
} |