welcome

随笔分类 -  文件

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

//博文图片放大缩小 //飘桃花效果