UNPKG

birdpaper-ui

Version:

一个通用的 vue3 UI组件库。A common vue3 UI component library.

41 lines (40 loc) 1.08 kB
import { defineComponent, computed, ref } from "vue"; import { IconCloseLine, IconCheckboxCircleFill, IconCloseCircleFill, IconErrorWarningFill, IconLoader5Line } from "birdpaper-icon"; const _sfc_main = defineComponent({ name: "Alert", props: { type: { type: String, default: "info" }, title: { type: String, default: "" }, closeable: { type: Boolean, default: false } }, emits: ["close"], components: { IconCloseLine }, setup(props, { emit, slots }) { const name = "bp-alert"; const iconType = { success: IconCheckboxCircleFill, error: IconCloseCircleFill, warning: IconErrorWarningFill, loading: IconLoader5Line }; const cls = computed(() => { return [name, `${name}-${props.type}`, props.title ? `${name}-with-title` : ""]; }); const isRender = ref(true); const handleClose = () => { isRender.value = false; emit("close"); }; return { name, cls, iconType, isRender, handleClose, slots }; } }); export { _sfc_main as default };