Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.12 KB

confirm.md

File metadata and controls

64 lines (48 loc) · 1.12 KB

dialog2/confirm

fe.xiaowu

dialog2/dialog 上扩展的一个confirm的快捷方式

use

require([
    'dialog2/confirm'
], function (Confirm) {
    new Confirm(title, content, ok, cancel);
});

events

dialog2/dialog#events 一致

api - options

/**
 * @param  {string} title 标题
 * @param {string} content 内容
 * @param {Function} callback 确定回调
 * @param {Function} cancel 取消回调
 */

example

confirm本身肯定会有确定和取消按钮

只有标题

require(['dialog2/confirm'], function (confirm) {
    new confirm('标题');
});

有标题和确定按钮回调

require(['dialog2/confirm'], function (confirm) {
    new confirm('str', function () {
        console.log('ok callback');
    });
});

有标题、内容和确定、取消按钮回调

require(['dialog2/confirm'], function (confirm) {
    new confirm('str', 'content', function () {
        console.log('ok callback');
    }, function () {
        console.log('cancel callback');
    });
});