Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

如何将Nuxt 项目的title设置为空(就是无title,而不是url)

如题 :

如何将Nuxt 项目的title设置为空(就是无title,而不是url)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

如下所示 :

<script>
export default {
  data() {
    return {
      pageTitle: '',
    }
  },
  watch: {
    $route() {
      this.setTitle()
    }
  },
  mounted() {
    this.setTitle()
  },
  methods: {
    setTitle(title) {
      this.pageTitle = title || 'u200E'
    }
  },
  head() {
    return {
      title: this.pageTitle
    }
  }
}
</script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...