弹窗
导入模块
import prompt from '@system.prompt';
权限列表
无
prompt.showToast(OBJECT)
显示文本弹窗。
-
参数
-
示例
prompt.showToast({ message: 'Message Info', duration: 2000, });
prompt.showDialog(OBJECT)
在页面内显示对话框。
-
参数
对话框中按钮的数组,结构为:{text:'button', color: '#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。
接口调用成功的回调函数,返回值如success返回值所示。
success返回值:
-
示例
prompt.showDialog({ title: 'Title Info', message: 'Message Info', buttons: [ { text: 'button', color: '#666666', }, ], success: function(data) { console.log('dialog success callback,click button : ' + data.index); }, cancel: function() { console.log('dialog cancel callback'); }, });