方法一:在vue.config.js中配置chainWebpack

chainWebpack: config =>{
    config.plugin('html').tap(args => {
        args[0].title = '你要更改的标题名称';
        return args;
    })
  },

 

方法二:将public文件夹下的入口index.html文件的标题更改为自己需要的标题

<title><%= htmlWebpackPlugin.options.title %></title>
改为:
<title>你想要的标题</title>

 

方法三:具体页面更改标题,在生命周期钩子函数中或者路由守卫中,通过document.title设置标题

document.title="你想要的标题"

 

方法四:通过vue-wechat-title插件修改

安装依赖:
npm install vue-wechat-title --save

引入依赖:
Vue.use(require('vue-wechat-title'))

使用方法一:
<div v-wechat-title="title">
data中配置title变量为'你想要的标题'

使用方法二:
<div v-wechat-title="'你想要的标题'">

 

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐