![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js问题
长影缚苍龙
这个作者很懒,什么都没留下…
展开
-
上传图片和文件
let fd = new FormData(); //传文件 fd.append("file", this.fileObj); //传图片 fd.append("file", this.getImg.raw); let config = { headers: { "Content-Type": "multipart/form-data", }, }; ...原创 2022-04-25 17:21:04 · 180 阅读 · 0 评论 -
vue/js实现文件下载(blob) 格式
downLoadAccoutFile: function (url) { var vm = this; this.$axios({ url: url, method: "post", headers: { "Content-Type": "application/json; application/octet-stream", }, responseType: "blob", .原创 2022-04-25 17:14:11 · 336 阅读 · 0 评论 -
数组和字符串方法以及是否改变原值
let arr=["A-b-C","dF"];JSON.stringify(arr) //数组转字符串console.log(arr)// ["A-b-C", "dF"] 不改变原数组let arr='["A-b-C","dF"]';JSON.parse(arr) //字符串转数组console.log(arr)// '["A-b-C","dF"]' 不改变原数组let arr=[2,3,6,4,7,1,8];arr.sort(function(a,b){ //排序return b原创 2021-11-22 10:34:04 · 528 阅读 · 0 评论 -
评论时间格式化
通过当前系统时间和数据库时间进行对比返回值有:yyyy-mm-dd 、mm-dd、x小时前、x分钟前 // 时间格式化 timeFormat(time) { let d = new Date(time); let yyyy = d.getFullYear(); let mm = d.getMonth() + 1 < 10 ? '0' + parseInt(d.getMonth() + 1) : d.getMonth() + 1; let dd = d.getDa原创 2021-10-26 10:44:34 · 115 阅读 · 0 评论 -
各种类型文件对应文件的 Content-Type
各种类型文件对应文件的 Content-Type /** * 两种初始化Map常量 * 1.new HashMap * 2.static 静态代码块 */ static Map<String , String> contentType = new HashMap<String , String>(200){ { put(".jpg","image/jpeg"); pu转载 2021-08-26 14:56:06 · 1744 阅读 · 0 评论 -
实现滚动轮改变多数据的echarts图表
<div ref="barEcharts"></div>// 添加滚轮事件 let gap = (deltaGap) => { let start = Number(this.lfBarZoomNumStart); let end = Number(this.lfBarZoomNumEnd); if (deltaGap > 0) { if (end != 100) { if (end +原创 2021-08-24 18:27:26 · 178 阅读 · 0 评论 -
js-xlsx导出excel文件
// 安装xlsxnmp install xlsx// 引入xlsximport XLSX from 'xlsx'exportFile(){// let data=[{ // 第一列表头:'第一行内容',// 第二列表头:'第一行内容',// 第三列表头:'第一行内容'// },{ // 第一列表头:'第二行内容', // 第二列表头:'第二行内容', // 第三列表头:'第二行内容' //}]; //数据处理开始 let pm = this.pmDat原创 2021-08-16 17:07:35 · 191 阅读 · 0 评论 -
js处理接口返回的二进制文件并下载,在线查看,空白问题
const blob = new Blob([r.data]); //创建blod对象const filename = item.fileName; //下载文件的名称const downloadElement = document.createElement(“a”); //创建a元素 const href = window.URL.createObjectURL(blob); //下载的链接downloadElement.href = href;[downloadEleme原创 2021-08-09 10:41:18 · 493 阅读 · 0 评论 -
输入开始时间和结束时间 计算两个时间相差多少天
vue methods方法 // 时间计算 mothTotalDays(year, moth) { let d = new Date(year, moth, 0); return d.getDate(); }, // 时间间距 dayGap(bfYear, bfMoth, bfDay, nowYear, nowMoth, nowDay) { let yearGap = nowYear - bfYear; let mothGap原创 2021-07-14 14:27:33 · 574 阅读 · 0 评论 -
object.keys和for-in返回值的顺序
碰到了一个很有意思的问题,js中对象属性的输出是有序的吗?如果有的话,那又遵循怎样的规则呢?这里我们来做一个简单的探讨,工作之余来一点趣味性的问题。虽不能醍醐灌顶,但可以巩固所学知识,也是极好的~????一、奇怪现象我们来看这样一个对象,来输出他的属性名称,也就是key值:var data = {‘1’:‘aaa’,‘2’:‘bbb’,‘3’:‘ccc’,‘测试’:‘000’};Object....转载 2020-03-02 16:28:59 · 440 阅读 · 0 评论 -
js常用方法
String---->是一个对象字符串可以看成是字符组成的数组,但是js中没有字符类型字符是一个一个的,在别的语言中字符用一对单引号括起来在js中字符串可以使用单引号也可以使用双引号因为字符串可以看成是数组,所以,可以通过for循环进行遍历字符串特性:不可变性,字符串的值是不能改变字符串的值之所以看起来是改变的,那是因为指向改变了,并不是真的值改变...转载 2019-12-23 14:06:07 · 95 阅读 · 0 评论 -
循环定义变量
for(var i=1;i<=5;i++){window[“const”+i]=i;}alert(const5);原创 2019-12-12 09:43:35 · 824 阅读 · 0 评论