mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-30 17:00:26 +08:00
增加API节点安装配置界面
This commit is contained in:
37
web/public/js/components/common/download-link.js
Normal file
37
web/public/js/components/common/download-link.js
Normal file
@@ -0,0 +1,37 @@
|
||||
Vue.component("download-link", {
|
||||
props: ["v-element", "v-file"],
|
||||
created: function () {
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
that.url = that.composeURL()
|
||||
}, 1000)
|
||||
},
|
||||
data: function () {
|
||||
let filename = this.vFile
|
||||
if (filename == null || filename.length == 0) {
|
||||
filename = "unknown-file"
|
||||
}
|
||||
return {
|
||||
file: filename,
|
||||
url: this.composeURL()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
composeURL: function () {
|
||||
let e = document.getElementById(this.vElement)
|
||||
if (e == null) {
|
||||
teaweb.warn("<download-link>找不到要下载的内容")
|
||||
return
|
||||
}
|
||||
let text = e.innerText
|
||||
if (text == null) {
|
||||
text = e.textContent
|
||||
}
|
||||
return Tea.url("/ui/download", {
|
||||
file: this.file,
|
||||
text: text
|
||||
})
|
||||
}
|
||||
},
|
||||
template: `<a :href="url" target="_blank"><slot></slot></a>`,
|
||||
})
|
||||
Reference in New Issue
Block a user