当前位置: 首页 > Web前端 > HTML5

vue2如何设置单个页面的title

时间:2023-04-05 01:37:19 HTML5

推荐使用vue-wechat-title插件下载安装插件依赖npminstallvue-wechat-title--save引入插件在main.jsimportVueWechatTitlefrom'vue-wechat-title'Vue.use(VueWechatTitle)在路由文件index.js中为每条路由添加一个标题routes:[{path:'/',name:'index',component:index,meta:{title:'主页'//这里设置标题}},{path:'/detail',name:'detail',component:detail,meta:{title:'详情页'//titleissethere}}]修改app.vue组件中的router-view再试一次,成功了