您的位置:首页 > Web前端 > JavaScript

ExtJs 常用方法(alert confirm prompt show wait)

2016-09-25 15:13 337 查看
1、alert方法

// 提示框
Ext.MessageBox.alert("提示信息","hello world!!!");
Ext.Msg.alert('ExtJs');
alert('执行');
注:执行到ExtJs中的alert方法不会停止运行。不同于原生的js alert方法

2、confirm方法

<span style="white-space:pre">	</span>//询问框
Ext.Msg.confirm('提示信息','确认要删除这条信息吗?',function(op){
if(op == 'yes'){
alert("确认删除");
}else{
alert("取消了");
}
})


3、prompt方法
<span style="white-space:pre">	</span>//输入框
Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
if (btn == 'ok'){
// process text value and close...
alert('ok');
}
console.info(btn); // 按钮
console.info(text); //输入框内容

});
4、show方法
//自定义提示信息
Ext.Msg.show({
title:'Save Changes?',
msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
buttons: Ext.Msg.YESNOCANCEL,  //显示的btn
icon: Ext.Msg.QUESTION//图标 4种  INFO QUESTION ERROR WARNING

});
5、wait方法

//等待框1
/*var p = Ext.create('Ext.ProgressBar', {
renderTo: Ext.getBody(),
width: 300
});
// Wait for 5 seconds, then update the status el (progress bar will auto-reset)
p.wait({
interval: 500, //bar will move fast!
duration: 50000,
increment: 15,
text: 'Updating...',
scope: this,
fn: function(){
p.updateText('Done!');
}
});*/
//等待框2
Ext.Msg.wait('提示信息','我是内容',{
interval: 500, 			//循环定时的间隔
duration: 10000,		//总时长
increment: 5,			//走完一次进度条次数
text: 'Updating...',	//进度条上的文字
scope: this,			//作用范围
fn: function(){			//回调函数
alert('更新成功!!!');
}
})


--------------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐