1 mui(‘#history-title‘).on(‘tap‘, ‘p‘, function(){ 2 mui.confirm(‘是否要删除全部搜索记录?‘,‘提示‘,[‘是‘,‘否‘],(event)=>{ 3 if (event.index === 0){ // 使用event.index获取用户选择的选项索引 4 window.localStorage.removeItem(‘historySearch‘) 5 fGetStorage() 6 mui.toast(‘清除成功‘,{ duration:‘short‘, type:‘div‘ }) 7 } 8 }) 9 })
mui.confirm中回调函数需要加event变量控制对话框的行为
原文:https://www.cnblogs.com/shamshing/p/14762270.html