H5打电话发短信

<meta name="format-detection" content="telephone=yes"/> <a href="tel:13660007710">13660007710</a> <a href="sms:13660007710">13660007710</a>

read more..

粘贴图片 ctrl+v

document.addEventListener("paste", function (event) { var isChrome = false; if (event.clipboardData || event.originalEvent) { //某些chrome版本使用的是event.originalEvent var clipboardData = event.clipboardData || event.originalEvent.clipboardData; if (clipboardData.items) { // for chrome var items = c...

read more..

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..