Good news: Last week, I released the new version of CodeSnap.dev. It's a major release with a lot of new features. I'm excited to see what you think about it.
Have a lovely week ☀️
To support me:
😘 Recommend the newsletter to your friends: it really helps!
Unhead is a framework-agnostic document head manager that you can use to manage page metadata like the title in your Vue application. It's used in the Nuxt core and is part of the UnJS ecosystem.
Installation
First, you need to install the @unhead/vue dependency to your project:
1
npminstall@unhead/vue
Next, you need to register the Vue plugin:
main.ts
1
import { createApp } from'vue'
2
import { createHead } from'@unhead/vue'
3
4
constapp = createApp()
5
6
consthead = createHead()
7
app.use(head)
8
9
app.mount('#app')
Usage
Now, you can use the useHead composable in your components, for example, to set the page title:
Component.vue
1
<scriptsetuplang=ts>
2
import { useHead } from'@unhead/vue'
3
4
useHead({
5
title:'My Portfolio Website'
6
})
7
</script>
Alternatively, you can use the <Head> component to set the page title:
👉🏻 A look at why frontend testing is worth the effort, why it possibly had a bad reputation in the past, and shares an approach to making tests easy to write and maintain.
评论
发表评论