modmenu.create('插件', [ { 'id': '1', 'type': 'category', 'title': '标题', 'enable': true }, { 'id': '2', 'type': 'switch', 'title': '拒绝密码框', 'enable': false }, { 'id': '3', 'type': 'switch', 'title': 'switch2 title' }, { 'id': '4', 'type': 'webview', 'data': 'text', //or //'url': 'http://xxxxx.com' }, { 'id': '5', 'type': 'button', 'title': 'button title' }, { 'id': '6', 'type': 'input', 'title': 'input title', 'val': 'default value' }, { 'type': 'collapse', 'title': 'collapse title', 'item': [ { 'id': '7', 'type': 'switch', 'title': 'switch title' } ], 'enable': true }, { 'id': '8', 'type': 'slider', 'title': 'slider title', 'val': 88, 'min': 1, 'max': 100 }, { 'id': '9', 'type': 'checkbox', 'title': 'checkbox title', 'enable': true }, { 'type': 'checkboxs', 'item': [ { 'id': '10', 'type': 'checkbox', 'title': '1 title' }, { 'id': '11', 'type': 'checkbox', 'title': '2 title' }, { 'id': '12', 'type': 'checkbox', 'title': '33333333 title' } ] }, { 'id': '13', 'type': 'radio', 'title': 'radio title', 'item': ['test', 'test2', 'test3'], 'check': 0 } ] , { onchange: function (result) { //注意在这里需要进行一下转换 result = JSON.parse(result); if(result.id === '1' && result.enable === true){ dialog.input('请输入密码', { ok: function (res) { if(res === '123456'){ //执行你需要的操作 }else{ //执行密码错误的操作 app.exitApp(); } }, cancel: function () { app.exitApp(); } }, ''); } console.log(result); } })

JS 代码修改:当 id 为 1 的元素 enable 属性为 true 时执行密码输入框

原文地址: https://www.cveoy.top/t/topic/oRl1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录