mine-h5-ui
Version:
一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍
77 lines (76 loc) • 2.67 kB
JavaScript
import { defineComponent as v, unref as e, openBlock as i, createElementBlock as l, normalizeStyle as C, normalizeClass as f, createElementVNode as s, withModifiers as B, toDisplayString as a, createCommentVNode as u, withDirectives as T, isRef as g, vModelText as h } from "vue";
import { useShow as w } from "./hooks.js";
const M = { class: "tips" }, D = {
key: 0,
class: "text"
}, S = {
key: 1,
class: "prompt"
}, V = { class: "label" }, z = ["innerHTML"], E = { class: "btn" }, N = /* @__PURE__ */ v({
name: "MeMessageBox",
__name: "index",
props: {
tips: { default: "提示" },
type: { default: "alert" },
message: { default: "" },
html: { default: "" },
cancelButtonText: { default: "取消" },
confirmButtonText: { default: "确认" },
onOk: { type: Function, default: () => () => {
} },
onOff: { type: Function, default: () => () => {
} }
},
emits: ["action"],
setup(t, { emit: y }) {
const p = y, k = t, { isShow: d, isDestroy: x, inputValue: c, onCancel: m, onConfirm: r, animationDuration: b } = w(k, p);
return (F, n) => e(x) ? u("", !0) : (i(), l("div", {
key: 0,
class: f(["me-message-box", { show: e(d) }]),
style: C(`--animation-duration:${e(b)}ms;`),
onClick: n[4] || (n[4] = //@ts-ignore
(...o) => e(m) && e(m)(...o))
}, [
s("div", {
class: f(["picker", { show: e(d) }]),
onClick: n[3] || (n[3] = B(() => {
}, ["stop"]))
}, [
s("h3", M, a(t.tips), 1),
["alert", "confirm"].includes(t.type) ? (i(), l("div", D, a(t.message), 1)) : u("", !0),
t.type === "prompt" ? (i(), l("div", S, [
s("label", V, a(t.message), 1),
T(s("input", {
"onUpdate:modelValue": n[0] || (n[0] = (o) => g(c) ? c.value = o : null),
type: "text",
class: "input"
}, null, 512), [
[h, e(c)]
])
])) : u("", !0),
t.type === "custom" ? (i(), l("div", {
key: 2,
innerHTML: t.html
}, null, 8, z)) : u("", !0),
s("div", E, [
t.type !== "alert" ? (i(), l("button", {
key: 0,
type: "button",
class: "btn-cancel",
onClick: n[1] || (n[1] = //@ts-ignore
(...o) => e(m) && e(m)(...o))
}, a(t.cancelButtonText), 1)) : u("", !0),
s("button", {
type: "button",
class: "btn-confirm",
onClick: n[2] || (n[2] = //@ts-ignore
(...o) => e(r) && e(r)(...o))
}, a(t.confirmButtonText), 1)
])
], 2)
], 6));
}
});
export {
N as default
};