關於vue2設置標題推薦使用vue-wechat-title插件
npm install vue-wechat-title --save 下
看后我的使用方式
1. 在 main.js 中
import VueWechatTitle from 'vue-wechat-title';
Vue.use(VueWechatTitle)
這樣就能用了
2. 路由中加下 title
{
path: '/',
component: Index,
meta: {
title: '首頁'
}
},
3. 在app.vue 中修改 router-view ,加入他的這個組件
<router-view v-wechat-title="$route.meta.title"></router-view>
這些都操作完成之后,你再重新加載頁面就可以看到你的title了