From f4e84540fefe81bdb75421a0448614481e471eaf Mon Sep 17 00:00:00 2001 From: purocean Date: Fri, 2 Aug 2019 18:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=80=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BE=93=E5=85=A5=E6=A1=86=E9=80=89=E6=8B=A9=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ModalUi.vue | 10 ++++++++-- frontend/src/components/TreeNode.vue | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/ModalUi.vue b/frontend/src/components/ModalUi.vue index 9b0e3bb4..d7300d2c 100644 --- a/frontend/src/components/ModalUi.vue +++ b/frontend/src/components/ModalUi.vue @@ -57,7 +57,7 @@ export default { this.resolve = resolve }) }, - input ({ type, title, hint, value, content }) { + input ({ type, title, hint, value, content, select = true }) { this.type = 'input' this.title = title || '请输入' this.content = content || '' @@ -68,7 +68,13 @@ export default { this.show = true this.$nextTick(() => { this.$refs.input.focus() - this.$refs.input.select() + + if (select) { + this.$refs.input.select() + if (Array.isArray(select)) { + this.$refs.input.setSelectionRange(...select) + } + } }) return new Promise(resolve => { diff --git a/frontend/src/components/TreeNode.vue b/frontend/src/components/TreeNode.vue index 35d52545..500a26aa 100644 --- a/frontend/src/components/TreeNode.vue +++ b/frontend/src/components/TreeNode.vue @@ -99,7 +99,8 @@ export default { title: '移动文件', hint: '新的路径', content: '当前路径:' + this.item.path, - value: this.item.path + value: this.item.path, + select: [this.item.path.lastIndexOf('/') + 1, this.item.path.length, 'forward'] }) if (!newPath) {