随笔分类 - JavaScript
JavaScript的常用方法
摘要:async export_data() { let zip = new JSZip() // 下载文件并添加到 ZIP for (const i of this.tableData) { const data = await fetch(i.path).then(response => respon
阅读全文
摘要:<template> <div> <el-upload ref="upload" class="upload-demo" action="#" accept="xlsx,xls" multiple :limit="1" :auto-upload="false" :withCredentials="f
阅读全文
摘要:PS:教程仅限于windows系统,其他操作系统教程请自行百度。 1、node版本(我用的这两个版本都没问题): node:v14.18.1、v14.18.2 2、安装pkg(推荐使用v5.7.0, v4.5.1是为了打包成32位操作系统可执行的exe): npm install -g pkg@5.
阅读全文
摘要:1、安装:npm install html2canvas jspdf --save 2、创建:html2canvas.js 文件,内容如下: import html2Canvas from 'html2canvas' import JsPDF from 'jspdf' /** * @param {S
阅读全文
摘要:公共: @blur="send_data.num = $event.target.value ? Number($event.target.value) : null" 不能输入小数点:oninput="value=value.replace(/[^\d]/g,'')" 可输入小数点:oninput
阅读全文
摘要:前提:getTableMaxHeight.js /** * @param {Number} difference_height 需要减去的值 * @return {Number} table的最大高度值 */ function getTableMaxHeight(difference_height)
阅读全文
摘要:layer.open({ type: 1, anim: 5, shade: 0, title: `标题`, resize: true, // 是否支持拉伸 maxmin: true, // 最大化最小化 scrollbar: false, area: ['850px', '550px'], // 宽
阅读全文
摘要:/* eslint-disable */ let idTmr; const getExplorer = () => { let explorer = window.navigator.userAgent; //ie if (explorer.indexOf("MSIE") >= 0) { retur
阅读全文
摘要:/** * 四舍五入,保留指定小数位数,当原始数据不满足长度时,不要补 0 * @param number [Number | String] 原始数据,支持字符串和数值型 * @param i [Number] 保留的小数个数 >= 0 * @returns [Number] 转换后的数据 */
阅读全文
摘要:参考链接:https://blog.csdn.net/Jie_1997/article/details/121928452
阅读全文
摘要:1、build/utils.js文件:解决打包后 element-ui 字体失效 if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader', publicP
阅读全文
摘要:let svg_dom = document.getElementById('station_svg').getSVGDocument() svg_dom.getElementById(item.id).style.fill = 'red'// 修改颜色 // 鼠标单击 svg_dom.getEle
阅读全文
摘要:/** * 功能:对比两个纯数组之间的数据差异 * @param {source_data} sourceData 原始数据(必选) * @param {String} newData 更新后的数据(必选) * @return {Array} 返回的 add_data, delete_data,更新
阅读全文
摘要:/** * @param {Array} sourceData 原始数据(必选) * @param {String} keyName 单条数据中的唯一标识符字段名(必选) * @param {String} parentKeyName 单条数据中的上级唯一标识符的字段名(必选) * @return
阅读全文
摘要:/** * @param {Array} dataList 完整数据(必传) * @param {Sting/Int} keyName 对哪个字段进行与targetID对比(必传) * @param {Sting/Int} targetID 目标数据的唯一标识符(必传) * @param {Stin
阅读全文
摘要:1、参考数据 [ { id: 1, label: '一级 1', children: [ { id: 4, label: '二级 1-1', children: [ { id: 9, label: '三级 1-1-1', }, { id: 10, label: '三级 1-1-2', }, ], }
阅读全文
摘要:1、只能输入数字: onkeyup="value = value.replace(/[^\d]/g,'')" 2、只能输入英文:onkeyup="value = value.replace(/[^a-zA-Z]/g,'')"
阅读全文
摘要:<template> <div class="model_box"> <div class="upload_bin"> <el-dialog width="400px" title="上传文件" :lock-scroll="true" :show-close="true" @close="cance
阅读全文
摘要:// 列表转树结构 list_to_tree() { let a = [ { id: 3, name: '测试3', up_id: 2, }, { id: 2, name: '测试2', up_id: 1, }, { id: 1, name: '测试1', up_id: null, }, ] let
阅读全文
摘要:1、<embed id="station_svg" :src="station_svg" type="image/svg+xml" /> 2、let svg_dom = document.getElementById('station_svg').getSVGDocument() // 获取dom
阅读全文