サンプルコード
export default {
// ...
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'something',
htmlAttrs: {
lang: 'en'
},
bodyAttrs: {
class: 'hoge-class'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
//...
}
解説
Nuxtでは、HTML
タグやBODY
タグが自動生成されてしまうため、classを直接指定出来ないが、nuxt.config.js
内でクラスを指定できる。