1、创建VUE
npm init vue@latest
//初始化VUE,执行创建向导任务
npm install
//安装相关依赖
npm run dev
//运行程序,查看创建结果
2、创建Echarts
npm install echarts
//安装Echarts插件
import * as echarts from echarts
//引用Echarts
3、引入router
npm install vue-router
4、设置main.js
import router from ../router/index
createApp(App).use(router).mount('#app')
5、设置index.js
点击查看代码
import { createRouter,createWebHashHistory } from "vue-router";
const router = createRouter({
history:createWebHashHistory(),
routes
})
const routes = [
{
path:'/index',
name:'index',
component:()=>('../views/index.vue')
}
]
export default router`