摘要:无法找到模块@/views/Login.vue的声明文件。 错误的原因:typescript 不能识别 .vue 文件 解决方法: 在项目vite-env.d.ts文件中添加以下代码 declare module '*.vue' { import { ComponentOptions } from
阅读全文
摘要:// 最好是定义一个表个通用数据,循环得到相关数据 const tableHeader = ref([ { header: '订单', key: 'index', width: 24 }, { header: '编号', key: 'number', width: 100 }, { header:
阅读全文
摘要:安装依赖 exceljs插件 file-saver下载插件 npm i exceljs npm i file-saver 引用 import * as ExcelJS from 'exceljs' import FileSaver from 'file-saver' 使用 // 设置标题列 cons
阅读全文
摘要:安装 npm install cropperjs@next 使用 <img ref="uploadImg" src="/cropperjs/v2/picture.jpg" alt="Picture"> // 引入 import Cropper from 'cropperjs'; // 样式 impo
阅读全文
摘要:安装 npm install xlsx-js-style --save 使用 引入 import XLSX from 'xlsx-js-style' // 最好是定义一个表个通用数据,循环得到相关数据 const tableHeader = [ { header: '序号', key: 'index
阅读全文
摘要:安装插件xlsx npm install xlsx 在需要的页面引入插件 import * as xlsx from 'xlsx' 使用xlsx读取excel文件 点击上传Excel文件 <template> <!-- 上传按钮 --> <el-upload action="#" :auto-upl
阅读全文
摘要:路由元信息 增加keepAlive:true , scrollTop: {top: 0} , { path: '/**/**', name: '**', component: () => import('@/views/**/index.vue'), meta: { title: '**', aff
阅读全文
摘要:使用vue自带的方法,如watchEffect() 提示'watchEffect' is not defined.eslint 解决办法,在.eslintrc.cjs文件中添加以下代码 module.exports = { root: true, extends: [ ... 'plugin:vit
阅读全文
摘要:props 注意: 只读,不能修改 props 可以实现父子组件通信,在vue3中我们可以通过defineProps获取父组件传递的数据。且在组件内部不需要引入defineProps方法可以直接使用! 子组件获取到props数据就可以在模板中使用了,但是切记props是只读的,不能修改 父组件给子组
阅读全文
摘要:vue3 项目创建 使用 vue 创建项目 命令 npm create vue@latest 基础配置 配置IP和localhost打开项目,修改'package.json'文件下的scripts配置 --host 0.0.0.0 显示ip地址可以打开项目 --open 启动项目,在浏览器中自动打开
阅读全文
摘要:技术栈 vue vite vant Vue Router pinia 使用vite初始化项目 执行命令 $ npm create vite@latest 安装 vant 执行命令 $ npm i vant
阅读全文