Skip to content
目录

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

属性名类型默认值描述
titleString''
messageString''
cancelTextString'取消'
confirmTextString'确定'
showExitBtnBooleanfalse
showCancelBooleantrue
successFunction() => {}成功
failFunction() => {}完成
js
title: _title = '',
message: _message = '',
cancelText: _cancelText = '取消',
confirmText: _confirmText = '确定',
showExitBtn: _showExitBtn = false,
showCancel: _showCancel = true,
successFunc :success = ()=>{}//成功
failFunc :fail = ()=>{} //完成

©2022 By 绝配移动端组件库