您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

API head方法

Nuxt.js 使用了  更新应用的 头部(Head) 和 html 。

使用 head 设置的头部。

在 head 里可通过 this 关键字来组件的数据,你可以利用组件的数据来设置个性化的  。

<template>
  <h1>{{ title }}</h1>
</template>

<script>
export default {
  data () {
    return {
      title: 'Hello World!'
    }
  },
  head () {
    return {
      title: this.title,
      : [
        { hid: 'description', name: 'description', content: 'My custom description' }
      ]
    }
  }
}
</script>

注意:为了避免子组件中的不能正确覆盖父组件中相同的而产生重复的现象,建议利用 hid 键为配唯一的标识编号。请阅读。


联系我
置顶