关键点 :
1.blob的type设置成表格
var blob = new Blob([res.data],{type : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
2.请求header里面设置:responseType:'blob'
内容不乱码,在axios中加 responseType:'blob'(此处为自己封装的axios, 请勿复制 )
js脚本在html中批量加入图片,我们需要设置一个父类的div,然后在创建子类,在创建好一个img的子类,将图片都添加进来,<html>
<body>
<div id='parent'>
<div class='pin'>
</div>
</div>
</body>
<script>
var oPin = document.createElement('div')
oPin.className = 'pin'
oParent.appendChild(oPin)
var oImg = document.createElement('img')
loadImg('./image/'+ data[i].src,callBack,oImg) //这里是你的图片地址
oImg.src = './image/'+ data[i].src
oPin.appendChild(oImg)
</script>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)