quick-admin-vue3-core
Version:
以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板
94 lines (93 loc) • 3.53 kB
JavaScript
import { defineComponent as E, useSlots as L, useAttrs as V, computed as _, resolveComponent as v, createBlock as b, openBlock as m, mergeProps as f, unref as t, withCtx as i, createElementVNode as h, normalizeClass as g, createVNode as C, createCommentVNode as P, renderSlot as w, createElementBlock as j, createTextVNode as x, toDisplayString as T, Fragment as q } from "vue";
import { a as z, u as D, b as F } from "./platform-DsTwHxm6.js";
import { f as M } from "./index-D-KS7NhM.js";
import { u as R } from "./vue-router-CAs1aAcA.js";
import { _ as G } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const H = /* @__PURE__ */ E({
__name: "BaseCopy",
props: {
to: {},
stop: { type: Boolean },
maxLine: { default: 1 },
clickIconCopy: { type: Boolean, default: void 0 },
successText: { default: "复制成功" },
toTooltip: { default: "点击跳转" }
},
setup(B) {
const r = {
...z,
content: "点击复制"
}, N = R(), p = B, u = L(), c = V(), a = _(() => {
const { onClick: e } = c, { to: n, clickIconCopy: s = !!n || !!e } = p;
return s;
}), o = _(() => {
var e;
return (e = u.default) == null ? void 0 : e.call(u).map((n) => n.children ?? "").join("");
});
function A(e) {
const { to: n, stop: s } = p;
if (!(!o.value || !n))
return s && e.stopPropagation(), N.push(n);
}
function I(e) {
var k;
if (!o.value) return;
const { tagName: n, classList: s } = e.target.parentNode, { stop: d, successText: S } = p;
d && e.stopPropagation();
const y = s.contains("icon") || n === "svg";
if (c.onClick && !y) return (k = c.onClick) == null ? void 0 : k.call(c);
if (a.value && !y) return;
const l = document.createElement("input");
l.setAttribute("value", o.value), document.body.appendChild(l), l.select(), document.execCommand("copy") && F(S, "success"), document.body.removeChild(l);
}
return (e, n) => {
const s = v("el-tooltip"), d = v("el-icon");
return m(), b(s, f(r, {
disabled: t(a) || !t(o)
}), {
default: i(() => [
h("div", {
onClick: I,
class: g(["base-copy", { "f-fs-c": +e.maxLine > 0, hover: t(o) && !t(a) }])
}, [
C(s, f(r, {
content: e.toTooltip,
disabled: !t(o) || !e.to
}), {
default: i(() => [
h("span", {
onClick: A,
class: g(["f-1", { [`q-line-${e.maxLine}`]: !0, link: !!e.to && t(o), click: t(o) && !!t(c).onClick }])
}, [
t(o) ? w(e.$slots, "default", { key: 0 }, () => [
x(T(t(o)), 1)
], !0) : (m(), j(q, { key: 1 }, [
x(T(t(D)), 1)
], 64))
], 2)
]),
_: 3
}, 16, ["content", "disabled"]),
t(o) ? (m(), b(s, f({ key: 0 }, r, {
disabled: !t(a)
}), {
default: i(() => [
C(d, { class: "f-0 ml-4 icon hover" }, {
default: i(() => [
C(t(M))
]),
_: 1
})
]),
_: 1
}, 16, ["disabled"])) : P("", !0)
], 2)
]),
_: 3
}, 16, ["disabled"]);
};
}
}), X = /* @__PURE__ */ G(H, [["__scopeId", "data-v-46e8570e"]]);
export {
X as default
};