Vue axios返回文件流

responseType:"blob", 请求接口的时候加上 let blob = new Blob([res], { type: "application/vnd.ms-excel", }); let url = window.URL.createObjectURL(blob); let link = document.createElement("a"); link.download = 'zz.xlsx' link.style.display = "none"; link.href = url; document.body.appendChild(link); ...

read more..

OSS分片式上传文件

Vue npm i ali-oss 配置oss.js import OSS from 'ali-oss' const client = new OSS({ region: 'oss-cn-hangzhou', accessKeyId: '---', accessKeySecret: '---', bucket: '---' }) export default client 使用 <div v-loading.fullscreen.lock="fullscreenLoading" :element-loading-text="loadingTxt"> <el-upload action="/upImg" ...

read more..

elementui resetFields属性未定义

我目前遇到的情况是  this.$refs[“ruleForm”].resetFields(); 提示未定义没有这个方法。但是我第二天重新打开项目就又好了。 当时报错解决方法是 this.$nextTick(() => { this.$refs["ruleForm"].resetFields(); });

read more..

Vue路由跳转

1. router-link2. this.$router.push() 3. this.$router.replace() (用法同push)4. this.$router.go(n) router-link <router-link :to="{name:'home'}"> <router-link :to="{path:'/home'}"> <router-link :to="{name:'home', params: {id:1}}"> 类似于post,第一次有效,刷新就消失 <router-link :to="{name:'home', query: {id:1}}"> 类似于get,拼接在路劲上 thi...

read more..

ElementUI

表单验证 // 整个表单验证 this.$refs.dialogRef.validate(()=>{}); // 单个字段 code是字段 this.$refs.dialogRef.validateField('code',()=>{}) 表单验证rule rules:{ code: [ { required: true, message: "请输入商品编码", trigger: "blur" }, { min: 1, max: 20, message: "编码为数字、英文(不区分大小写),...

read more..

Electron-vue

需要运行环境和打包程序 npm i -g electron npm i -g electron-builder 项目安装 vue init simulatedgreg/electron-vue my-project 其中–platform是配置打包成什么平台的安装文件,下面是可选的值 win系统: win或者win32,即–platform=win或者–platform=win32mac系统:mac或者darwin,即–platform=mac或者–platform=darwinLinux系统:linux, 即–platfor...

read more..

Vue中EXCEL的导入导出

import FileSaver from 'file-saver' import XLSX from 'xlsx' 导入 <el-upload class="upload-demo" drag action="https://jsonplaceholder.typicode.com/posts/" multiple accept=".xlsx" :on-exceed="exceed" :limit="1" :on-remove="remove" :http-request="uploadFile" > <i class="el-icon-upload"></i> ...

read more..