In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to dynamically set up the page title of the vue+webpack project". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
First, take a look at how to set the title of a page in webpack.
1. Webapck mainly uses HtmlWebpackPlugin to replace the title of the html page. In the vue project, install the HtmlWebpackPlugin plug-in.
Npm install html-webpack-plugin-save-dev
After the installation is successful, the package.json file will have an extra line "html-webpack-plugin": "xxxx"
2. Instantiate the plug-in in the plugins configured by webpack and set the title name.
New HtmlWebpackPlugin ({template:'. / src/index.ejs', filename:'. / index.html', title: "title name", favicon: "", inject: false, hash: true})
The above is the basic use of setting headings in webpack
Second, dynamically set the page title
1. Install dependencies and use the vue-wechat-title plug-in
Npm install vue-wechat-title-save
2. Introduce it into main.js
Import VueWechatTitle from 'vue-wechat-title'Vue.use (VueWechatTitle)
3. Add the parameters of the corresponding title to the js route corresponding to router
4. Then implement it in our entry file index.vue or app.vue
5. If it is a public component, the title can be set dynamically according to the conditions when the jump occurs. You can set vmurwechat title = "$route.meta.title" on the outermost div and then dynamically change the title.
Npm run dev can restart the project. OK, a dynamic title will be generated.
This is the end of the content of "how to dynamically set up the page title of the vue+webpack project". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.