cc-plus-ui
Version:
自用的二次封装elementui组件
100 lines (99 loc) • 2.68 kB
JavaScript
import { defineComponent as c, ref as B, resolveComponent as r, openBlock as i, createBlock as u, mergeProps as s, withCtx as p, createVNode as b, renderSlot as _ } from "vue";
const g = c({
name: "CcButton"
}), k = /* @__PURE__ */ c({
...g,
props: {
time: { default: 1e3 },
tip: { default: "" },
placement: { default: "top" },
tipProps: { default: () => ({}) },
size: {},
disabled: { type: Boolean },
type: {},
icon: {},
nativeType: {},
loading: { type: Boolean },
loadingIcon: {},
plain: { type: Boolean },
text: { type: Boolean },
link: { type: Boolean },
bg: { type: Boolean },
autofocus: { type: Boolean },
round: { type: Boolean },
circle: { type: Boolean },
color: {},
dark: { type: Boolean },
autoInsertSpace: { type: Boolean },
tag: {}
},
emits: ["click"],
setup(t, { emit: e }) {
const n = t, l = e, a = B(0), d = () => {
(/* @__PURE__ */ new Date()).getTime() - a.value > n.time && (l("click"), a.value = (/* @__PURE__ */ new Date()).getTime());
};
return (o, O) => {
const m = r("el-button"), y = r("el-tooltip");
return o.tip ? (i(), u(y, s({
key: 0,
content: o.tip,
placement: o.placement
}, o.tipProps), {
default: p(() => [
b(m, s(o.$attrs, {
class: "cc-button-tip",
onClick: d
}), {
default: p(() => [
_(o.$slots, "default", {}, void 0, !0)
]),
_: 3
}, 16)
]),
_: 3
}, 16, ["content", "placement"])) : (i(), u(m, s({ key: 1 }, o.$attrs, { onClick: d }), {
default: p(() => [
_(o.$slots, "default", {}, void 0, !0)
]),
_: 3
}, 16));
};
}
}), v = (t, e) => {
const n = t.__vccOpts || t;
for (const [l, a] of e)
n[l] = a;
return n;
}, C = /* @__PURE__ */ v(k, [["__scopeId", "data-v-ef5a7a6e"]]), f = (t) => {
const e = t;
return e.install = (n) => {
console.log(e.name), n.component(e.name, e);
}, e;
}, T = f(C), $ = c({
name: "CcTable"
}), h = /* @__PURE__ */ c({
...$,
props: {
foo: { type: String, required: !0 },
bar: Number
},
setup(t) {
return (e, n) => {
const l = r("el-table");
return i(), u(l);
};
}
}), w = f(h), S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
CcButton: T,
CcTable: w
}, Symbol.toStringTag, { value: "Module" })), I = (t) => {
Object.values(S).forEach((e) => {
e.install && e.install(t);
});
}, j = { install: I };
export {
T as CcButton,
w as CcTable,
j as default
};