vxe-table-pro
Version:
Vue table plugins based on vxe-table
76 lines (75 loc) • 1.8 kB
JavaScript
import { defineComponent as c, mergeModels as s, useModel as d, ref as p, watch as f, resolveComponent as m, createBlock as y, openBlock as h } from "vue";
const V = /* @__PURE__ */ c({
__name: "index",
props: /* @__PURE__ */ s({
options: {
type: Array,
default: () => []
},
queryOptions: {
type: Function,
default: null
},
placeholder: {
type: String,
default: "请选择"
},
optionKey: {
type: String,
default: ""
},
checkStrictly: {
type: Boolean,
default: !1
}
}, {
modelValue: { default: null },
modelModifiers: {}
}),
emits: ["update:modelValue"],
setup(n) {
const u = d(n, "modelValue"), e = n, o = p([]);
f(
() => [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 i = (l) => {
var t;
l && ((t = e.queryOptions) == null || t.call(e).then((a) => {
o.value = a;
}));
};
return (l, t) => {
const a = m("el-cascader");
return h(), y(a, {
modelValue: u.value,
"onUpdate:modelValue": t[0] || (t[0] = (r) => u.value = r),
options: o.value,
props: { checkStrictly: n.checkStrictly },
clearable: "",
filterable: "",
placeholder: n.placeholder,
onVisibleChange: i
}, null, 8, ["modelValue", "options", "props", "placeholder"]);
};
}
});
export {
V as default
};