exportUtils.js
628 Bytes
export default {
methods:{
downloadTxt(text, fileName){
let element = document.createElement('a')
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
element.setAttribute('download', fileName)
element.style.display = 'none'
element.click()
},
createTextContent(jzdInfo){
var textContent = "";
for(var i = 0;i < jzdInfo.length;i++){
textContent += jzdInfo[i].jzdh +","+jzdInfo[i].sxh+"," +
jzdInfo[i].x+","+jzdInfo[i].y+"\n"
}
return textContent;
},
}
}