mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 06:40:27 +08:00
26 lines
533 B
JavaScript
26 lines
533 B
JavaScript
|
|
Vue.component("file-textarea", {
|
||
|
|
props: ["value"],
|
||
|
|
data: function () {
|
||
|
|
let value = this.value
|
||
|
|
if (typeof value != "string") {
|
||
|
|
value = ""
|
||
|
|
}
|
||
|
|
return {
|
||
|
|
realValue: value
|
||
|
|
}
|
||
|
|
},
|
||
|
|
mounted: function () {
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
drop: function (e) {
|
||
|
|
let that = this
|
||
|
|
e.dataTransfer.items[0].getAsFile().text().then(function (data) {
|
||
|
|
that.setValue(data)
|
||
|
|
})
|
||
|
|
},
|
||
|
|
setValue: function (value) {
|
||
|
|
this.realValue = value
|
||
|
|
}
|
||
|
|
},
|
||
|
|
template: `<textarea @drop.prevent="drop" ref="textarea" v-model="realValue"></textarea>`
|
||
|
|
})
|