mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
refactor(nuxt)!: remove null
handling for titleTemplate
(#6487)
This commit is contained in:
parent
cafd3938ed
commit
408febada4
@ -15,20 +15,10 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
headReady = true
|
||||
})
|
||||
|
||||
const titleTemplate = ref<MetaObject['titleTemplate']>()
|
||||
|
||||
nuxtApp._useHead = (_meta: MetaObject | ComputedGetter<MetaObject>) => {
|
||||
const meta = ref<MetaObject>(_meta)
|
||||
if ('titleTemplate' in meta.value) {
|
||||
titleTemplate.value = meta.value.titleTemplate
|
||||
}
|
||||
|
||||
const headObj = computed(() => {
|
||||
const overrides: MetaObject = { meta: [] }
|
||||
// cast a null titleTemplate to an empty string so @vueuse/head ignores it
|
||||
if (titleTemplate.value === null) {
|
||||
overrides.titleTemplate = ''
|
||||
}
|
||||
if (meta.value.charset) {
|
||||
overrides.meta!.push({ key: 'charset', charset: meta.value.charset })
|
||||
}
|
||||
|
2
test/fixtures/basic/pages/index.vue
vendored
2
test/fixtures/basic/pages/index.vue
vendored
@ -27,7 +27,7 @@ const config = useRuntimeConfig()
|
||||
|
||||
// reset title template example
|
||||
useHead({
|
||||
titleTemplate: null
|
||||
titleTemplate: ''
|
||||
})
|
||||
|
||||
const foo = useFoo()
|
||||
|
Loading…
Reference in New Issue
Block a user