Get the App
SLTechnology News&Howtos  ›  Development  › 

The operation method of setting title by vuejs

Shulou Source: shulou.com Published: 2022-06-03 10:48:32 11月14日 Update

Vuejs set title operation, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

The method of setting title in vuejs: 1, install "vue-wechat-title" through npm install; 2, introduce "vue-wechat-title" in main.js; 3, add title to each route in index.js.

This article operating environment: windows7 system, Vue2.9.6 version, Dell G3 computer.

How does vuejs set up title?

Vue single page title setting title

Front-end frameworks such as Vue, React and so on are single-page applications, the whole web site is actually an index page, page jump is to replace the content in index.html. This is different from the traditional practice of setting title tags on each page.

Vue-wechat-title is recommended

Vue-wechat-title action

The title of Vuejs single-page application in the webview of some APP under iOS cannot be modified by document.title = xxx. The plugin is only created to solve this problem (compatible with Android).

Tested APP

WeChat

QQ

Alipay

Taobao

Install npm install vue-wechat-title-save usage 1 and introduce import VueWechatTitle from 'vue-wechat-title'Vue.use (VueWechatTitle) 2 into main.js Add title// mount route const router = new Router to each route in the route file index.js ({mode: 'history', routes: [{path:' /', name: 'Index', component: Index, meta: {title:' home page / / title setting}}) {path:'/ lists', name: 'Lists', component: Lists, meta: {title:' list'/ / title setting}}]}) 3, modify the router-view component in app.vue

The custom loaded image address defaults to. / favicon.ico can be relative or absolute

Ok! Restart it.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Page title route method content system help application clarity tradition function practice front end picture address this plug-in file article novice Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Docker macOS OPPO Reno Redmi