Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The operation method of setting title by vuejs

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report