You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

39 lines
964 B

import { createApp } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'
import './style.css'
import 'vant/lib/index.css' // 引入vant样式
import App from './App.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
name: 'Home',
component: () => import('./views/Home.vue'),
}, {
path: '/list',
name: 'List',
component: () => import('./views/List.vue'),
},
{
path: '/carts',
name: 'Carts',
component: () => import('./views/Carts.vue'),
},
{
path: '/user',
name: 'User',
component: () => import('./views/User.vue'),
}
]
})
// 路由前置守卫
router.beforeEach((to, from, next) => {
console.log('beforeEach');
next();
});
// 使用router组件
createApp(App).use(router).mount('#app')