Skip to content
Title

Modal 弹框

使用弹框

  • 如果你想像用例一样直接使用,你需要全局注册组件,才能够直接在项目里使用。
复制代码
vue
<template>
  <button
    type="submit"
    @click="onClickVisible"
  >
    Modal
  </button>
  <b-modal
    title="bearUI:modal"
    :visible="visibleRef"
    width="700px"
    @cancel="onClickCancel"
    @confirm="onClickConfirm"
  >
    <template #default>
      <div><button>contain</button></div>
    </template>
  </b-modal>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import BModal from '@bear-ui/components/modal'
const visibleRef = ref(false)
function onClickVisible () {
  visibleRef.value = !visibleRef.value
}
function onClickCancel () {
  visibleRef.value = !visibleRef.value
}
function onClickConfirm () {
  visibleRef.value = !visibleRef.value
}
</script>

API

Icon Props

名称类型默认值说明
titlestringundefined弹框标题
visibleBooleanundefined是否显示弹框
widthstringundefined弹框宽度

Released under the MIT License.