基本用法
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渲染 | Boolean | true/false | false | PC/Mobile | -- |
returnInstance | 是否返回实例 | Boolean | true/false | false | PC/Mobile | -- |
button | button 文字配置 | Object | {confirmText/ 确认文字 /,cancelText/ 取消文字 /} | null | PC | -- |
noTarget | 不使用全局配置的挂载点,恢复默认的body为挂载点 | Boolean | -- | false | PC | -- |
type | 指定枚举类型,用户自定义,相同type同时触发只显示一个 | string | -- | -- | PC/Mobile | -- |