mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-13 06:54:18 +00:00
feat: 系统用户上传ssh协议i18n翻译
This commit is contained in:
parent
048fee7ede
commit
cd5534c20a
@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
@ -21,12 +25,22 @@ export default {
|
||||
default: () => 'string'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileName: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onUpLoad() {
|
||||
this.$refs.upLoadFile.click()
|
||||
},
|
||||
onChange(e) {
|
||||
if (e.target.files.length === 0) {
|
||||
const upLoadFile = e.target.files
|
||||
if (upLoadFile.length === 0) {
|
||||
return
|
||||
}
|
||||
const vm = this
|
||||
this.fileName = upLoadFile[0].name || ''
|
||||
const reader = new FileReader()
|
||||
reader.onload = function() {
|
||||
let result = this.result
|
||||
@ -36,7 +50,7 @@ export default {
|
||||
vm.$emit('input', result)
|
||||
}
|
||||
reader.readAsText(
|
||||
e.target.files[0]
|
||||
upLoadFile[0]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user