它是如何在cordova插件对话框中使用参数按钮Index的

How does it work the argument buttonIndex in cordova-plugin-dialogs?

本文关键字:参数 按钮 Index 对话框 插件 cordova      更新时间:2024-05-18

嗨,我在设置时遇到问题

if (buttonIndex == 1) {
//do stuff
} else if (buttonIndex == 2) {
//II do stuff
}

那么应用程序知道if中的buttonIndex吗?是否只在function onConfirm(buttonIndex){}中知道关于buttonIndex?一般是关于确认对话框https://www.npmjs.com/package/cordova-plugin-dialogs#navigatornotificationconfirm该对话框有效,但仅显示信息当点击"Tak"按钮时,索引==1(Tak是英文的是),然后我想在<li>上加上名称chipsy(英文芯片),并在<ul>上加上一个按钮,这不起作用这是我的代码http://pastebin.com/Wf7untcY

这是附加问题还是按钮索引问题?

解决了函数"content"序列错误的问题

右侧订单

function onConfirm(buttonIndex) {
                                if (buttonIndex == 1) {
                                    var li = $('<li/>');
                                    var lv = $('#lv');
                                    var divP = $('<div/>', {
                                                'class':"ui-grid-a"}).appendTo(li);
                                    var divC1 = $('<div/>', {
                                                 'class':"ui-block-a",
                                                 text:'chips'}).appendTo(divP);
                                    var btnDel = $('<button/>', {
                                                 'class':"ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-inline",
                                                 click: function() {
                                                    li.empty();
                                                 }
                                    });
                                    var divC2 = $('<div/>', {
                                                'class':"ui-block-b"}).appendTo(divP).append(btnDel);
                                    lv.append(li);
                                    window.plugins.toast.showLongBottom('Added chips to shopping list');
                                } else if (buttonIndex == 2) {
                                    window.plugins.toast.showLongBottom('Not added');
                                }
                            }
                            navigator.notification.confirm('Do you want to add chips to beer?', onConfirm, 'Basket Analysis', ['Yes','No']);