web123456

Vue3-31-Route-The function of the name attribute of RouterView

// Import Two ways to define routes import {createRouter,createWebHistory} from 'vue-router' // Introduce two components import componentA from "./"; import componentB from "./"; import componentC from "./"; // Declare the corresponding relationship between the path of the route jump and the component const routsList = [ { path:'/showAllComponents', name:'aroute', components:{ default : componentA, first : componentB, second : componentC }, }, ] // Create a routed instance object const routerConfigObj = createRouter({ history:createWebHistory('abc'), // With a parameter, it means that it is a prefix for the route routes:routsList // Specify the configuration list of routes }) // Export the routed object export default routerConfigObj;