当前位置: 首页 > news >正文

vite+vue3+element-plus

vite+vue3+element-plus

1.开始

npm create vite@latest app -- --template vuenpm installlnpm run dev

2.引入element-ui

npm install element-plus
修改main.js
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
createApp(App).use(ElementPlus).mount('#app')

3.安装vue-router

npm install vue-router@4
修改main.js
import router from "./router"
不识别@
npm i @types/node -D
修改vue.config.js

import { resolve } from 'path'export default defineConfig {// ...resolve: {alias: {"@": resolve(__dirname, 'src'), // 路径别名},extensions: ['.js', '.json', '.ts'] // 使用路径别名时想要省略的后缀名,可以自己 增减}
}
index.js
import { createRouter, createWebHistory } from "vue-router"
import Index from '@/view/index/index.vue'const router = createRouter({history: createWebHistory(),routes : [{ path: '/', redirect: '/index' },{path: '/',name:'index',component: () => import('../view/index/index.vue'),children:[{path: '/index',name: 'index',component: Index}]}]
})export default router

在这里插入图片描述

http://www.lryc.cn/news/153971.html

相关文章:

  • uni-app 之 tabBar 底部切换按钮
  • VSCode 配置 C 语言编程环境
  • LeetCode 热题 100——找到字符串中所有字母异位词(滑动窗口)
  • uniapp从零到一的学习商城实战
  • 应广单片机实现跑马灯
  • 关于el-input和el-select宽度不一致问题解决
  • 【Unity3D赛车游戏优化篇】【八】汽车实现镜头的流畅跟随,以及不同角度的切换
  • VScode连接远程JupyterNotebook显示点云ply文件
  • python安装wind10
  • uni-app 中 swiper 轮播图高度自适应
  • 开源风雷CFD软件多物理场耦合接口开发路线分享!!!
  • 浅谈Mysql读写分离的坑以及应对的方案 | 京东云技术团队
  • 最近在对接电商供应链,说说开放平台API接口
  • 【FusionInsight 迁移】HBase从C50迁移到6.5.1(02)C50上准备FTP Server
  • Java操作符学习笔记
  • 【STM32】学习笔记-PWR(Power Control)电源控制
  • 安卓 MeasureCache优化了什么?
  • docker save docker export 区别
  • 音频基础知识
  • TensorFlow(R与Python系列第四篇)
  • 华为数通方向HCIP-DataCom H12-821题库(单选题:261-280)
  • 论文《基于概率标签估计的半监督日志缺陷检测》翻译
  • ajax day2
  • 互联网摸鱼日报(2023-09-04)
  • UG\NX CAM二次开发 遍历组中的工序 UF_NCGROUP_ask_member_list
  • 适配器、装饰器模式
  • Netty服务端启动的整体流程-基于源码4.1.96Final分析
  • 预训练Bert添加new token的问题
  • 非常典型和高效的枚举类写法
  • kafka-- kafka集群环境搭建