赞
踩
安装@vue/cli
npm install @vue/cli -g
或 yarn global add @vue/cli
创建项目
vue create 项目名
可以选择Vue3的配置进行项目初始化
import { createRouter, createWebHashHistory } from 'vue-router' const Test = () => import(/* webpackChunkName: "Test" */ '@/views/test/index') const constantRoutes = [ { path: '/v3-demo', component: Test } ] // https://www.npmjs.com/package/vue-router const router = createRouter({ history: createWebHashHistory(), routes: constantRoutes, }) export default router
main.js引入
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
const app = createApp(App)
app.use(ElementPlus)
app.use(router)
app.mount('#app')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。