使用vue-wechat-title
npm网址如下:https://www.npmjs.com/package/vue-wechat-title
1、安装:
npm install vue-wechat-title --save
2、在main.js中引入
import VueWechatTitle from 'vue-wechat-title'; Vue.use(VueWechatTitle);
3、在路由中添加对应的tittle
{ path:'/contact', name:'contact', component:resolve => require(['@/components/contact.vue'],resolve), meta:{ title:'联系我们', keepAlive:false, } },
4、在router-view 中绑定title
<router-view v-wechat-title='$route.meta.title'></router-view>