UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

72 lines (71 loc) 2.27 kB
import { defineComponent as f, createElementBlock as i, createCommentVNode as o, unref as e, openBlock as n, normalizeClass as v, createElementVNode as m, Fragment as h, createBlock as c, toDisplayString as u, createVNode as I } from "vue"; import { useAlert as w } from "./hook/useAlert.mjs"; import { Icon as s } from "@vuux/icons"; const C = { class: "alert-content" }, _ = { class: "content-title" }, g = { key: 0, class: "content-description" }, V = /* @__PURE__ */ f({ name: "Alert", __name: "index", props: { type: { default: "info" }, title: {}, description: {}, showIcon: { type: Boolean }, showClose: { type: Boolean } }, emits: ["close"], setup(a, { emit: d }) { const t = a, y = d, { isShow: k, iconSize: r, hanleClose: l } = w(t, y); return (B, p) => e(k) ? (n(), i("div", { key: 0, class: v(["app-alert", `is-${t.type}`]) }, [ a.showIcon ? (n(), i(h, { key: 0 }, [ t.type === "success" ? (n(), c(e(s), { key: 0, name: "Icon5524835", size: e(r), color: "var(--app-success)" }, null, 8, ["size"])) : o("", !0), t.type === "info" ? (n(), c(e(s), { key: 1, name: "Icon4835048", size: e(r), color: "var(--app-primary)" }, null, 8, ["size"])) : o("", !0), t.type === "error" ? (n(), c(e(s), { key: 2, name: "Icon5212574", size: e(r), color: "var(--app-danger)" }, null, 8, ["size"])) : o("", !0), t.type === "warning" ? (n(), c(e(s), { key: 3, name: "Icon7903790", size: e(r), color: "var(--app-warning)" }, null, 8, ["size"])) : o("", !0) ], 64)) : o("", !0), m("div", C, [ m("div", _, u(t.title), 1), t.description ? (n(), i("div", g, u(t.description), 1)) : o("", !0) ]), a.showClose ? (n(), i("div", { key: 1, class: "alert-close", onClick: p[0] || (p[0] = //@ts-ignore (...z) => e(l) && e(l)(...z)) }, [ I(e(s), { name: "Icon9176904", size: 12, opacity: 0.8 }) ])) : o("", !0) ], 2)) : o("", !0); } }); export { V as default };