Understanding the root node:

The fixed rule for root components in Vue2 is that the root component must have a unique root node

The template of a component in Vue3 can have no root node or not


Routing module:

In the routing module: the definition of routing and the lazy loading of components have not changed

What changed was when the Vue instance object was originally created:

// The definition of routes is omitted..
Vue2 creates an instance object
const router = new VueRouter({
   routes
})
Copy the code

How to create instance objects in Vue3:

// This is Vue3 style, everything is imported on demand to save space when packing
// Where history: createWebHashHistory() means hash routing
// There is another routing mode on Vue's official website, which uses historical API routing mode:
// history: createWebHistory()
import { createRouter,createWebHashHistory } from 'vue-router'
import Home from '.. /views/Home.vue'

Vue3 creates an instance object
const router = createRouter({
  history: createWebHashHistory(),
  routes
})
Copy the code