Modal 弹框
Modal
通过showExitBtn
showCancel
控制按钮个数
vue
<template>
<jp-page class="rsmodal">
<view class="jp-bg-gap title">Modal: 2个按钮</view>
<button class="btn" @click="doShowSuccess">点击弹出</button>
<view class="jp-bg-gap title">Modal: 1个取消按钮:[ showCancel: false ]</view>
<button class="btn" @click="doShowSuccess2">点击弹出</button>
<view class="jp-bg-gap title">Modal: 1个确认按钮:[ showExitBtn: true ]</view>
<button class="btn" @click="doShowSuccess3">点击弹出</button>
</jp-page>
</template>
<script lang="ts" setup>
const { showModal } = useStore('globalUI')
const doShowSuccess = () => {
showModal({
title: '提示',
message: '确认退出当前账户吗?',
cancelText: '取消',
confirmText: '退出',
success: () => {},
fail: () => {}
})
}
const doShowSuccess2 = () => {
showModal({
title: '提示',
message: '确认退出当前账户吗?',
cancelText: '取消',
showCancel: false,
confirmText: '确定',
success: (res) => {}
})
}
const doShowSuccess3 = () => {
showModal({
title: '提示',
message: '您暂无权限,请联系管理员',
showExitBtn: true,
success: (res) => {}
})
}
</script>
<style scoped lang="scss">
.rsmodal {
padding: 12px;
.title {
margin-top: 12px;
padding: 12px;
font-size: 14px;
color: #666;
}
}
</style>
showModal option
属性名 | 类型 | 默认值 | 描述 |
---|---|---|---|
title | String | '' | |
message | String | '' | |
cancelText | String | '取消' | |
confirmText | String | '确定' | |
showExitBtn | Boolean | false | |
showCancel | Boolean | true | |
success | Function | () => {} | 成功 |
fail | Function | () => {} | 完成 |
js
title: _title = '',
message: _message = '',
cancelText: _cancelText = '取消',
confirmText: _confirmText = '确定',
showExitBtn: _showExitBtn = false,
showCancel: _showCancel = true,
successFunc :success = ()=>{}//成功
failFunc :fail = ()=>{} //完成