mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-14 15:36:01 +00:00
feat: 系统用户上传ssh协议i18n翻译
This commit is contained in:
parent
048fee7ede
commit
cd5534c20a
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="upload-key">
|
<div class="upload-key">
|
||||||
<input type="file" @change="onChange">
|
<input ref="upLoadFile" type="file" style="display: none" @change="onChange">
|
||||||
|
<el-button size="mini" @click.native.stop="onUpLoad">
|
||||||
|
{{ this.$t('common.SelectFile') }}
|
||||||
|
</el-button>
|
||||||
|
<span>{{ fileName }}</span>
|
||||||
<div v-if="tip !== ''">{{ tip }}</div>
|
<div v-if="tip !== ''">{{ tip }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -21,12 +25,22 @@ export default {
|
|||||||
default: () => 'string'
|
default: () => 'string'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fileName: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onUpLoad() {
|
||||||
|
this.$refs.upLoadFile.click()
|
||||||
|
},
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
if (e.target.files.length === 0) {
|
const upLoadFile = e.target.files
|
||||||
|
if (upLoadFile.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const vm = this
|
const vm = this
|
||||||
|
this.fileName = upLoadFile[0].name || ''
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = function() {
|
reader.onload = function() {
|
||||||
let result = this.result
|
let result = this.result
|
||||||
@ -36,7 +50,7 @@ export default {
|
|||||||
vm.$emit('input', result)
|
vm.$emit('input', result)
|
||||||
}
|
}
|
||||||
reader.readAsText(
|
reader.readAsText(
|
||||||
e.target.files[0]
|
upLoadFile[0]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user