mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 05:25:39 +08:00
Merge pull request #80 from wanmeihuaxu/master
bug fix:showSelectList options的closeOnSelect设置为false时,选项只能点一次
This commit is contained in:
commit
61d711765b
@ -186,6 +186,9 @@ export default {
|
|||||||
* initItems = [{title: "1", description: "1"}, {title: "2", description: "2"}, {title: "3", description: "3"}]
|
* initItems = [{title: "1", description: "1"}, {title: "2", description: "2"}, {title: "3", description: "3"}]
|
||||||
* options = {placeholder: "输入进行筛选,支持拼音", optionType: "json", enableSearch: true, showCancelButton: false, closeOnSelect: true}
|
* options = {placeholder: "输入进行筛选,支持拼音", optionType: "json", enableSearch: true, showCancelButton: false, closeOnSelect: true}
|
||||||
*
|
*
|
||||||
|
* 如需对每个选项单独注册点击事件,可以在initItems的元素中添加id和clickFn,如:
|
||||||
|
* initItems = [{id:1, title: "1", description: "1", clickFn:function(e){console.log(e)}}, {id:2, title: "2", description: "2", clickFn:function(e){console.log(e)}}]
|
||||||
|
*
|
||||||
* @example
|
* @example
|
||||||
* initItems = ["<div>1</div>", "<div>2</div>", "<div>3</div>"]
|
* initItems = ["<div>1</div>", "<div>2</div>", "<div>3</div>"]
|
||||||
* options = {placeholder: "输入进行筛选,支持拼音", optionType: "html", enableSearch: true, showCancelButton: false, closeOnSelect: true}
|
* options = {placeholder: "输入进行筛选,支持拼音", optionType: "html", enableSearch: true, showCancelButton: false, closeOnSelect: true}
|
||||||
|
@ -144,7 +144,7 @@ export default {
|
|||||||
id: this.currentIndex,
|
id: this.currentIndex,
|
||||||
text: this.matchedItems[this.currentIndex],
|
text: this.matchedItems[this.currentIndex],
|
||||||
};
|
};
|
||||||
this.$emit("clickOK", selected);
|
this.is.json && selected.clickFn ? selected.clickFn(this.matchedItems[this.currentIndex].id) : this.$emit("clickOK", selected);
|
||||||
this.options.options.closeOnSelect && this.hide();
|
this.options.options.closeOnSelect && this.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
11
src/plugins/monaco/types/quickcommand.api.d.ts
vendored
11
src/plugins/monaco/types/quickcommand.api.d.ts
vendored
@ -55,8 +55,15 @@ interface quickcommandApi {
|
|||||||
* // json
|
* // json
|
||||||
* var opt = []
|
* var opt = []
|
||||||
* for (var i = 0; i < 15; i++) {
|
* for (var i = 0; i < 15; i++) {
|
||||||
* // 每一个选项为 json 格式
|
* // 每一个选项为 json 格式, 使用clickFn注册选项单击事件时id属性是必需的
|
||||||
* opt.push({title: `选项${i}`, description: `选项${i}的描述`, icon: `http://www.u.tools/favicon.ico`,abcd: `选项${i}的自定义属性`})
|
* opt.push({
|
||||||
|
* id: i,
|
||||||
|
* title: `选项${i}`,
|
||||||
|
* description: `选项${i}的描述`,
|
||||||
|
* icon: `http://www.u.tools/favicon.ico`,
|
||||||
|
* abcd: `选项${i}的自定义属性`,
|
||||||
|
* clickFn:function(e){console.log(e)}
|
||||||
|
* })
|
||||||
* }
|
* }
|
||||||
* quickcommand.showSelectList(opt, {optionType: 'json'}).then(choise => {
|
* quickcommand.showSelectList(opt, {optionType: 'json'}).then(choise => {
|
||||||
* console.log(`选择的选项为${choise.title}`)
|
* console.log(`选择的选项为${choise.title}`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user