mine-h5-ui
Version:
一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍
37 lines (36 loc) • 1.09 kB
JavaScript
import { createVNode as O, render as h } from "vue";
import { IsType as c } from "../MeAPI/function.js";
import m from "./index.vue.js";
/*!
* mine-h5-ui v2.16.0
* Copyright (c) 2025 biaov
* @license MIT
*/
const o = (e, t) => {
if (c("Object", e)) {
if (e.html && e.html.includes("script"))
throw new Error("Your HTML may be attacked by XSS");
return new Promise((f, i) => {
const r = { ...e };
t && (r.type = t), r.onAction = (l, s) => {
switch (l) {
case "onOk":
r.onOk ? r.onOk(s) : f(s);
break;
case "onOff":
r.onOff ? r.onOff() : i();
break;
}
};
const d = O(m, r), n = document.createElement("div");
h(d, n), document.body.appendChild(n.firstElementChild);
});
} else throw new Error(`${e} is not Object`);
}, a = o, b = ["alert", "confirm", "prompt", "custom"];
b.forEach((e) => {
a[e] = (t) => c("string", t) ? o({ message: t }, e) : o(t, e);
});
a.componentName = m.name;
export {
a as default
};