随笔分类 - 文件
摘要:// 上传前 beforeUpload(file) { // 创建一个Image对象 const image = new Image(); // 设置图片的src为选中文件的对象url image.src = URL.createObjectURL(file); return new Promise
阅读全文
摘要:npm install jsqr <template> <div> <button type="primary" @click="handUpload">上传图片</button> <div style="display: none;"> <input type="file" accept="ima
阅读全文
摘要:<img :src="tempimg" @load="loadImage" @error="errorLoad" /> 图片加载完成的回调,完成后再去调用 //调用html2canvas方法需先下载,版本 ^1.4.1npm install html2canvas import html2canva
阅读全文
摘要:/** * 下载图片到本地 * @param {String} domId img标签的id * @param {String} name 下载图片名称 */ function downloadCanvasIamge(domId, name){ let image = new Image() //
阅读全文
摘要:1.转File对象 let files = new window.File([bits], file.name, {type: file.type}) bits img/Blob/base64 格式图片 2.File对象转base64 封装 async fileToBase64(file) { /*
阅读全文
摘要:1、压缩方法公共js /** 图片压缩,默认同比例压缩 * @param {Object} fileObj * 图片对象 * 回调函数有一个参数,base64的字符串数据 */ export function compress(fileObj, callback) { try { const ima
阅读全文
摘要:import request from '@/router/axios' downfiles(uri) { return request({ url: uri, method: 'get', responseType: 'blob', timeout: 1800000, }).then((respo
阅读全文
摘要:<div style="height: 100px; width: 100px; border: 1px solid red; position: relative;"> 点击上传 <input onchange="uploadFile()" id="upload" multiple="multip
阅读全文
摘要:一、调用浏览器打印插件 这种方式打印的pdf比较高清,且分页不会截断文字和图片,背景图片是会被截断的 1.直接打印 直接调用浏览器的打印功能,打印整个页面 function preview () { window.print(); } 2.打印指定区域 通过开始标记、结束标记来打印,打印局部页面 <
阅读全文

浙公网安备 33010602011771号