Vue Page Title, a Vue.js Plugin

Words
71
Reading
1 min
Listen
Play
8y

Vue.js html/page title manager

Repository

https://github.com/vinicius73/vue-page-title

What is the project about?

A plugin for Vue.js that centralizes and makes it easy to manipulate the page title tag.

Usage

Setup

import Vue from 'vue'
import VuePageTitle from 'vue-page-title'

Vue.use(VuePageTitle, {
  suffix: '- My App '
})

in component

<script>
export default {
  title: 'Page title',
  mounted () {
    const servantTypes = [
      'Ruler', 'Saber', 'Archer', 'Lancer', 'Rider', 'Caster', 'Berserker', 'Assassin'
    ]
    this.$interval = setInterval(() => {
      this.$title = servantTypes[Math.floor(Math.random() * servantTypes.length)]
    }, 2000)
  },
  beforeDestroy () {
    clearInterval(this.$interval)
  }
}
</script>

<template>
  <div>{{ $title }}</div>
</template>

Technology Stack

  • rollup
    To provide various package formats, opening up more possibilities of use.
  • ava
    A simple yet fast and efficient test runner

How to contribute?

Contact on Discord (vinicius73#5705), Github Issues or Replying to this post

GitHub Account

https://github.com/vinicius73

Vue Page Title, a Vue.js Plugin | Ecency