vxe-table-pro
Version:
Vue table plugins based on vxe-table
105 lines (104 loc) • 3.07 kB
JavaScript
import { defineComponent as L, ref as f, watch as b, resolveComponent as c, createElementBlock as a, openBlock as o, createVNode as p, createBlock as d, createCommentVNode as N, withCtx as l, Fragment as _, renderList as m, createTextVNode as v, toDisplayString as w, unref as q } from "vue";
import { MoreFilled as F } from "@element-plus/icons-vue";
import { _ as g } from "./index-B8MbCfO1.mjs";
const B = { class: "operate-container" }, V = ["onClick"], D = /* @__PURE__ */ L({
__name: "index",
props: {
options: {
type: Array,
default: () => []
},
queryOptions: {
type: Function,
default: null
},
onClick: {
type: Function,
default: () => {
}
},
showLen: {
type: Number,
default: 3
},
index: {
type: Number,
default: 0
},
row: {
type: Object,
default: () => ({})
}
},
setup(t) {
const e = t, i = f([]), r = f([]), k = () => {
var s;
if (e.queryOptions) {
const u = ((s = e.queryOptions) == null ? void 0 : s.call(e, e.row)) || [];
i.value = u.slice(0, e.showLen) || [], r.value = u.slice(e.showLen) || [];
} else
i.value = e.options.slice(0, e.showLen) || [], r.value = e.options.slice(e.showLen) || [];
};
return b(
() => [e.showLen, e.options, e.queryOptions],
() => {
k();
},
{
deep: !0,
immediate: !0
}
), (s, u) => {
const y = c("el-link"), h = c("el-space"), x = c("el-icon"), C = c("el-popover");
return o(), a("div", B, [
p(h, null, {
default: l(() => [
(o(!0), a(_, null, m(i.value, (n) => (o(), d(y, {
key: n.value,
underline: !1,
type: n.type || "primary",
onClick: (O) => t.onClick({ type: n.value, row: t.row, index: t.index })
}, {
default: l(() => [
v(w(n.label), 1)
]),
_: 2
}, 1032, ["type", "onClick"]))), 128))
]),
_: 1
}),
r.value.length ? (o(), d(C, { key: 0 }, {
default: l(() => [
(o(!0), a(_, null, m(r.value, (n) => (o(), a("div", {
class: "item-line",
onClick: (O) => t.onClick({ type: n.value, row: t.row, index: t.index })
}, [
(o(), d(y, {
key: n.value,
underline: !1,
type: n.type || "primary"
}, {
default: l(() => [
v(w(n.label), 1)
]),
_: 2
}, 1032, ["type"]))
], 8, V))), 256))
]),
reference: l(() => [
p(x, { class: "icon-style" }, {
default: l(() => [
p(q(F))
]),
_: 1
})
]),
_: 1
})) : N("", !0)
]);
};
}
}), E = /* @__PURE__ */ g(D, [["__scopeId", "data-v-06bafd06"]]);
export {
E as default
};