In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, Xiaobian will bring you about Vue's method of implementing routing nesting. The article is rich in content and analyzed and described from a professional perspective. After reading this article, I hope you can gain something.
1. Nested routing, also known as sub-routing, is usually composed of multiple nested components in practical applications. (In fact, it is just a doll operation, which is quite similar to the view jump path at the back end):
2. Create a user information component, and create a view component named Profile.vue under the views/user directory:
Profile.vue
1 export default { name: "UserList" }
3. Create a view component named List.vue in the user list component under the views/user directory:
List.vue
2 export default { name: "UserList" }
4. Modify the home page view. We modify the Main.vue view component, where the ElementUI layout container component is used. The code is as follows:
Main.vue
user management personal information user list content management classification management content list personal information log out export default { name: "Main" } .el-header { background-color: #B3C0D1; color: #333; line-height: 60px; } .el-aside { color: #333; }
5. Configure nested routing Modify the index.js routing configuration file under the router directory, and use children to write submodules in the main, the code is as follows:
index.js
//import vueVue from 'vue';import VueRouter from 'vue-router';//import components import Main from "../ views/Main";import Login from "../ views/Login";//import submodules import UserList from "../ views/user/List";import UserProfile from "../ views/user/Profile";//use Vue.use(VueRouter);//export default new VueRouter({ routes: [ { //Login page path: '/main', component: Main, //write submodule children: [ { path: '/user/profile', component: UserProfile, }, { path: '/user/list', component: UserList, }, ] }, //Home { path: '/login', component: Login }, ]})
6. Operation results:
7. Project structure:
8. Then we add a function:
Add this code to Main.vue:
Salted Fish_Turn Over Management Salted Fish_Turn Over 4 Salted Fish_Turn Over 5
The above is what Vue's method of implementing routing nesting shared by Xiaobian for everyone is. If there is a similar doubt, please refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.