This commit is contained in:
tanghc
2020-10-14 21:02:41 +08:00
parent 1850d6d567
commit 0c4dd04bc7
29 changed files with 536 additions and 441 deletions

View File

@@ -94,6 +94,18 @@ Object.assign(Vue.prototype, {
}
}).catch(function() {})
},
downloadText(filename, text) {
const element = document.createElement('a')
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
element.setAttribute('download', filename)
element.style.display = 'none'
document.body.appendChild(element)
element.click()
document.body.removeChild(element);
},
/**
* 重置表单
* @param formName 表单元素的ref