Skip to content

对话框 Modal

基础用法

vue
<template>
  <bp-button @click="handleClick">open modal</bp-button>
</template>

<script lang="ts" setup>
import { Modal } from "@birdpaper-ui/components";

const handleClick = ()=>{
  Modal.info({
    title: "title",
    content: "content",
  });
}
</script>

自定义底部

vue
<template>
  <bp-button @click="handleOpen">Custom footer</bp-button>

  <bp-modal v-model="show" title="Title">
    <p>Modal content.</p>

    <template #footer>
      <bp-button type="secondary" @click="show = false">Cancle</bp-button>
      <bp-button type="secondary" status="danger" @click="show = false">Confirm delete</bp-button>
    </template>
  </bp-modal>
</template>

<script setup lang="ts">
import { ref } from "vue";

const show = ref(false);

const handleOpen = () => {
  show.value = true;
};
</script>
v-model是否显示
Boolean
--
is-method是否通过方法调用
Boolean
--
type类型
String
--
title标题
String
--
content内容
String
--
width宽度
StringNumber
50%-
body-class内容区域样式类
String
--
border-radius圆角
String
8px-
center是否居中
Boolean
--
show-border是否显示边框
Boolean
true-
top距离顶部
String
0-
bottom距离底部
String
0-
mask-closable点击遮罩是否关闭
Boolean
true-
hide-header是否隐藏头部
Boolean
--
hide-footer是否隐藏底部
Boolean
--
hide-close是否隐藏关闭按钮
Boolean
--
fullscreen是否全屏
Boolean
--
ok-text确认按钮文字
String
确认-
ok-btn-props确认按钮属性
Object
--
cancel-text取消按钮文字
String
取消-
cancel-btn-props取消按钮属性
Object
--
hide-cancel是否隐藏取消按钮
Boolean
--
hide-title-icon是否隐藏标题图标
Boolean
--
on-before-ok确认前回调
Function
--
cancel取消触发--
confirm确认触发--
default内容--
header头部--
footer底部--