vxe-table-pro
Version:
Vue table plugins based on vxe-table
84 lines (83 loc) • 2.11 kB
JavaScript
import { defineComponent as f, mergeModels as y, useModel as v, ref as _, watch as g, resolveComponent as d, createBlock as s, openBlock as u, mergeProps as V, withCtx as p, createElementBlock as h, Fragment as O, renderList as q, createTextVNode as x, toDisplayString as b } from "vue";
const C = /* @__PURE__ */ f({
__name: "index",
props: /* @__PURE__ */ y({
options: {
type: Array,
default: () => []
},
queryOptions: {
type: Function,
default: null
},
placeholder: {
type: String,
default: "请选择"
},
optionKey: {
type: String,
default: ""
}
}, {
modelValue: { default: [] },
modelModifiers: {}
}),
emits: ["update:modelValue"],
setup(r) {
const i = v(r, "modelValue"), e = r, o = _([]);
g(
() => [e.options, e.queryOptions],
() => {
var l;
if (e.queryOptions) {
(l = e.queryOptions) == null || l.call(e).then((t) => {
o.value = t;
});
return;
}
if (e.options) {
o.value = e.options;
return;
}
e.optionKey && (o.value = e.options[e.optionKey] || []);
},
{
immediate: !0
}
);
const c = (l) => {
var t;
l && ((t = e.queryOptions) == null || t.call(e).then((a) => {
o.value = a;
}));
};
return (l, t) => {
const a = d("el-radio"), m = d("el-radio-group");
return u(), s(m, V({
modelValue: i.value,
"onUpdate:modelValue": t[0] || (t[0] = (n) => i.value = n),
style: { width: "100%" }
}, e, {
filterable: "",
clearable: "",
onVisibleChange: c
}), {
default: p(() => [
(u(!0), h(O, null, q(o.value, (n) => (u(), s(a, {
key: n.value,
value: n.value
}, {
default: p(() => [
x(b(n.label), 1)
]),
_: 2
}, 1032, ["value"]))), 128))
]),
_: 1
}, 16, ["modelValue"]);
};
}
});
export {
C as default
};