插件:npm install vue-wechat-title
入口文件引入:
import vueWechatTitle from 'vue-wechat-title'
Vue.use(vueWechatTitle)
路由文件:
{
path: '/newDynamic',
name: 'newDynamic',
component:()=> import('@/view/newDynamic/newDynamic.vue'),
meta: { title: '标题' }
}
单页面添加:
在需要修改的页面添加:
<div v-wechat-title="$route.meta.title"></div>
或者在app.vue文件中:
<router-view v-wechat-title="$route.meta.title"></router-view>
也可以动态的改变title:
<div v-wechat-title="$route.meta.title={data.title}"></div>
参考链接:https://blog.csdn.net/csdn9_14/article/details/98748736