- 安装依赖:npm install vue-w echat-title --save
- main.js引入
- import VueWechatTitle from 'vue-wechat-title'
- 路由中设置 {
path: '/home',
component: home,
meta: {
title: “首页”, //标题
}
}, - app.vue设置v-wechat-title="$route.meta.title"
- <div class="app">
<router-view v-wechat-title="$route.meta.title"></router-view>
</div>
- <div class="app">
转载于:https://my.oschina.net/u/4051564/blog/3009642