增加模态组件输入框选择范围功能

This commit is contained in:
purocean
2019-08-02 18:42:23 +08:00
parent 1567efa282
commit f4e84540fe
2 changed files with 10 additions and 3 deletions
+8 -2
View File
@@ -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 => {
+2 -1
View File
@@ -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) {