diff --git a/src/preload.js b/src/preload.js index 6416c4d..51dc03c 100644 --- a/src/preload.js +++ b/src/preload.js @@ -235,26 +235,25 @@ quickcommand = { }, // 更新选项列表 - updateSelectList: function (selects) { + updateSelectList: function (opt, id) { if(!$('#selectBox').length) throw '当前没有选择列表, 请结合 quickcommand.showSelectList 使用' let data = $('#selectBox').data('options') let num = data.length + typeof id == 'undefined' && (id = num) + if (id > num) throw 'id 不能大于当前列表数' let optionType = $('#selectBox').data('type') - selects instanceof Array || (selects = [selects]) - let item - selects.forEach(s => { - item = {id: num++} - if (optionType == 'json') { - item.text = '' - Object.keys(s).forEach(k => item[k] = s[k]) - s.icon && (item.text += `