vue3配合vue router4使用
router// Vue Router 4import { createRouter, createWebHistory } from "vue-router";import index from '../views/index.vue'import one from '../views/one.vue'export default createRouter({history: createWeb
·
使用命令行查看vue-router 所有版本号
npm info vue-router versions
安装最新的vue-router
yarn add vue-router@4.0.0-beta.10
router
// Vue Router 4
import { createRouter, createWebHistory } from "vue-router";
import index from '../views/index.vue'
import one from '../views/one.vue'
export default createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
component: index
},
{
path: '/one',
component: one
}
],
});
main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './index.css'
const app = createApp(App);
app.use(router);
app.mount("#app");
更多推荐
已为社区贡献8条内容
所有评论(0)