跳到主要内容
Alert
用于在页面上弹出一个模态框,显示一些重要或需要用户确认的信息,比如警告、错误、询问等,通常有一个或多个按钮,可以执行确定或取消等操作。

基本用法

PCPhonePad
<page>
<button text="alert" bindclick='alertHandle'></button>
<button text="confirm" bindclick='confirmHandle'></button>
</page>

export default XPage({
data: {text:'我是按钮'},
confirmHandle(){
CabinX.confirm('朕已经知道了1', function (val) {})

CabinX.confirm({
title: '提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示',
text: '朕已经知道了1'
}, function (val) {
if (val) {
setTimeout(() => {
CabinX.alert('我知道了')
}, 100)
}
})
},
alertHandle(){
CabinX.alert({
title: '提示',
text: '朕已经知道了1'
}, function () {})
}
});


Attributes

作为API使用,不能直接使用标签,如:CabinX.alert('朕已经知道了1', function () {}),CabinX.confirm('朕已经知道了1', function ( val) {}) [注] 目前不支持按钮自定文案

参数说明类型可选值默认值版本
title弹框标题String----PC/Mobile--
text提示文案String----PC/Mobile--
dangerouslyUseHTMLString是否使用HTML渲染Booleantrue/falsefalsePC/Mobile--
returnInstance是否返回实例Booleantrue/falsefalsePC/Mobile--
buttonbutton 文字配置Object{confirmText/ 确认文字 /,cancelText/ 取消文字 /}nullPC--
noTarget不使用全局配置的挂载点,恢复默认的body为挂载点Boolean--falsePC--
type指定枚举类型,用户自定义,相同type同时触发只显示一个string----PC/Mobile--