大哥你好,我这边有个情况想请教下。
以下代码,我再控制台上运行,会正常再输入框下方出现列表。
但是我如果保存开启后,在utools搜索框输入关键字,选择后,直接就退出了。
为什么会这样?
var opt = []
axios.defaults.headers.post['token'] = 'xxxxxxxxx';
opt.push({ title: `清除data_dict缓存`, description: `输入指定ENV环境和code`, map: 1 })
opt.push({ title: `清除剧缓存`, description: `输入指定剧ID`, map: 2 })
let { id } = await quickcommand.showSelectList(opt, { optionType: 'json' }).then(choise => {
console.log(`选择的选项为${choise.title}`)
switch (choise.map) {
case 1:
var opt2 = []
opt2.push({ title: `爸我答对了`, description: `QQ小程序`, env: `ENV_QQ_NC_MINI5` })
opt2.push({ title: `答题大富豪`, description: `安卓APP`, env: `ENV_ANDROID1` })
quickcommand.showSelectList(opt2, { optionType: 'json' }).then(choise => {
console.log(`选择的选项为${choise.env}`);
axios({
method: 'post',
url: `https://api.shanju.fun/h5/redis/dict/clean?env=${choise.env}`,
}).then(function(response) {
// console.log(response);
if (response.data.message == 'success') {
quickcommand.showMessageBox("缓存已清除", "success", 2000)
} else {
console.log(response.status);
}
})
.catch(function(error) {
console.log(error);
})
})
// utools.shellOpenItem(file);
break;
case 2:
// utools.shellShowItemInFolder(file);
break;
case 3:
// utools.copyText(file);
break;
default:
break;
}
})