How to Set webpage title on vue2 single page and vue2 webpage title
The content in the response, and the title of the page is set only once when each page is initialized. For the current front-end framework, the traditional method of setting the title label for each page is not good.
We recommend that you use the vue-wechat-title plug-in.
Download and install plug-in Dependencies
Npm install vue-wechat-title -- save
Introduce plug-ins in main. js
Import VueWechatTitle from 'vue-wechat-title' vue. use (VueWechatTitle)
Add a title to each route in the route file index. js.
Routes: [{path: '/', name: 'index', component: index, meta: {title: 'homepage' // set the title here },{ path: '/detail', name: 'detail', component: detail, meta: {title: 'details page' // set the title here}]
Modify the router-view component in app. vue.
<Router-view v-wechat-title = '$ route. meta. title'> </router-view>
Restart and try again.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.