UNPKG

common-mini-components

Version:

公共组件

149 lines (148 loc) 5.97 kB
import { defineComponent as D, openBlock as g, createElementBlock as I, renderSlot as v, getCurrentInstance as T, ref as N, resolveComponent as A, createVNode as h, createSlots as w, withCtx as m, createElementVNode as u, createTextVNode as f, toDisplayString as _, Fragment as C, renderList as x, pushScopeId as O, popScopeId as S } from "vue"; const H = /* @__PURE__ */ D({ __name: "index", emits: ["click"], setup(e) { return (t, s) => (g(), I("button", { class: "my-button1", onClick: s[0] || (s[0] = (n) => t.$emit("click", n)) }, [v(t.$slots, "default", {}, void 0, !0)])); } }); const z = (e, t) => { const s = e.__vccOpts || e; for (const [n, c] of t) s[n] = c; return s; }, Y = /* @__PURE__ */ z(H, [["__scopeId", "data-v-66b9c0bb"]]), E = { install(e) { e.component("my-button", Y); } }, Q = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjc5NjI1MzQwMzMxIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjI1OTYiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTUxMiAyOC4wNTc2YTQ3Ny44NjY2NjcgNDc3Ljg2NjY2NyAwIDEgMCAwIDk1NS43MzMzMzMgNDc3Ljg2NjY2NyA0NzcuODY2NjY3IDAgMCAwIDAtOTU1LjczMzMzM3pNNTEyIDExMS45NTczMzNhMzk0LjAzNTIgMzk0LjAzNTIgMCAxIDEgMCA3ODguMDcwNEEzOTQuMDM1MiAzOTQuMDM1MiAwIDEgMSA1MTIgMTExLjk1NzMzM3ogbTAgMzI4Ljk3NzA2N2MyOS4wODE2IDAgNDMuNjIyNCAxNC41NDA4IDQzLjYyMjQgNDMuNTU0MTMzdjIyNi42NDUzMzRjMCAyOS4xNDk4NjctMTQuNTQwOCA0My42OTA2NjctNDMuNjIyNCA0My42OTA2NjYtMjkuMDgxNiAwLTQzLjYyMjQtMTQuNTQwOC00My42MjI0LTQzLjY5MDY2NnYtMjI2LjY0NTMzNGMwLTI5LjAxMzMzMyAxNC41NDA4LTQzLjU1NDEzMyA0My42MjI0LTQzLjU1NDEzM3pNNDQ4LjMwNzIgMzIwLjg1MzMzM2E2My42OTI4IDYzLjY5MjggMCAwIDAgMTI3LjM4NTYgMCA2My42OTI4IDYzLjY5MjggMCAwIDAtMTI3LjM4NTYgMHoiIGZpbGw9IiMwMDZBRkYiIHAtaWQ9IjI1OTciPjwvcGF0aD48L3N2Zz4="; function P(e, t, s) { return new Promise((n, c) => { const o = new XMLHttpRequest(); o.open(t, e), o.setRequestHeader("Content-Type", "application/json;charset=UTF-8"), o.setRequestHeader("X-Gaia-Api-Key", s), o.send(null), o.onreadystatechange = function() { if (o.readyState === 4) if (o.status >= 200 && o.status < 300 || o.status === 304) { const p = JSON.parse(o.responseText); console.log(p), n(p); } else console.log("request was unsuccessful:" + o.status), c("请求出错了"); }; }); } const k = (e, t) => P(e, "GET", t); function B() { const { appContext: e } = T(); console.log("---a-appContext-", e); const t = e.config.globalProperties; return console.log("--b---", t), { globalProperties: t }; } let R = {}; const y = R, G = (e) => (O("data-v-c4a051f7"), e = e(), S(), e), U = { class: "cm-plus-ihelp" }, W = /* @__PURE__ */ G(() => /* @__PURE__ */ u("img", { src: Q, class: "svg-icon", alt: "" }, null, -1)), F = { class: "cm-help-title" }, Z = { class: "cm-help-code" }, V = { class: "cm-help-content" }, $ = { class: "test" }, q = /* @__PURE__ */ D({ __name: "index", props: { code: { default: "" }, trigger: { default: "hover" }, isDebug: { type: Boolean, default: !1 } }, setup(e) { const t = e, { globalProperties: s } = B(); console.log("-ihelp-globalProperties-=", s); const n = "https://c2-openapi.longfor.com/cm-help/public/helpByCode/", c = "http://api.longfor.sit/cm-help-sit/public/helpByCode/", o = t.isDebug ? c : `${n}${t.code}`, p = { "X-Gaia-Api-Key": t.isDebug ? "83ac390b-261e-46d2-ab07-5e830b432eb0" : "8c40819a-bd4c-4115-9f12-164a04ea74e9" }, d = N(""), M = N([]), i = N(!1), L = async () => { const { code: a, data: l } = await k(o, p["X-Gaia-Api-Key"]); a === 1e4 && (console.log("-2-"), s.globalIHelpData[`${t.code}`] = { name: l.name, detailList: l.detailList }, y[`${t.code}`] = { name: l.name, detailList: l.detailList }, i.value = !0, d.value = l.name, M.value = l.detailList); }, b = () => { if (console.log("-show--", s.globalIHelpData, y), !t.code) return; const a = s.globalIHelpData[t.code], l = y[t.code]; let r = !1; a && (console.log("-1-1"), r = !0, i.value = !0, d.value = a.name, M.value = a.detailList), l && (console.log("-1-2"), r = !0, i.value = !0, d.value = l.name, M.value = l.detailList), !r && L(); }; return (a, l) => { const r = A("el-popover"); return g(), I("div", U, [h(r, { placement: "top-start", width: "300", trigger: t.trigger, "show-arrow": !1, "popper-class": i.value ? "" : "common-components-ihelp-popver-class", onShow: b }, w({ reference: m(() => [W]), _: 2 }, [i.value ? { name: "default", fn: m(() => [u("div", F, [f(_(d.value) + " ", 1), u("span", Z, "(" + _(t.code) + ")", 1)]), u("div", V, [(g(!0), I(C, null, x(M.value, (j) => (g(), I("div", { key: j.id, class: "cm-help-item" }, [u("div", $, _(j.content), 1)]))), 128))])]), key: "0" } : void 0]), 1032, ["trigger", "popper-class"])]); }; } }); const X = /* @__PURE__ */ z(q, [["__scopeId", "data-v-c4a051f7"]]), J = (e) => { console.log("-----lai1------"), e.globalIHelpData = {}; }, K = { install(e) { console.log("-----lai0------"); const t = e.config.globalProperties; J(t); } }, ee = { install(e) { e.component("my-ihelp", X), console.log("---ust0000---"), K.install(e); } }, oe = { install(e) { console.log("--a-sd----"), E.install?.(e), ee.install?.(e); } }; export { E as ButtonPlugin, K as GlobalPropPlugin, ee as IHelpPlugin, Y as MyButton, X as MyIhelp, oe as default };