This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2021-11-14 20:57:36 +00:00
|
|
|
import { computed, watchEffect } from 'vue'
|
|
|
|
import { setTitle } from '@/helpers/setTitle'
|
|
|
|
|
2022-01-30 15:47:23 +00:00
|
|
|
import { ComputedGetter } from '@vue/reactivity'
|
2021-11-14 20:57:36 +00:00
|
|
|
|
2022-01-30 15:47:23 +00:00
|
|
|
export function useTitle(titleGetter: ComputedGetter<string>) {
|
2021-11-14 20:57:36 +00:00
|
|
|
const titleRef = computed(titleGetter)
|
|
|
|
|
|
|
|
watchEffect(() => setTitle(titleRef.value))
|
|
|
|
|
|
|
|
return titleRef
|
|
|
|
}
|