yanzhen-design-vue
Version:
41 lines (40 loc) • 1.61 kB
JavaScript
import { defineComponent, openBlock, createBlock, unref, mergeProps, isRef } from "vue";
import { Cascader } from "ant-design-vue";
import { useCascader } from "./use-cascader.mjs";
import { cascaderName, cascaderProps, cascaderEmits, cascaderOptions } from "./cascader.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
...{ name: cascaderName },
__name: "cascader",
props: cascaderProps,
emits: cascaderEmits,
setup(__props, { expose: __expose, emit: __emit }) {
const { ns } = cascaderOptions;
const props = __props;
const emit = __emit;
const [
{ _ref, modelValue, propsRef, optionsRef, handleChange, handleVisibleChange, handleLoadData }
] = useCascader(props, emit);
__expose({
/** @description button html element */
ref: _ref
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(Cascader), mergeProps({
ref_key: "_ref",
ref: _ref
}, unref(propsRef), {
value: unref(modelValue),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
"field-names": { label: props.labelKey, value: props.valueKey, children: props.childrenKey },
options: unref(optionsRef),
class: [unref(ns).b()],
"load-data": unref(handleLoadData),
onChange: unref(handleChange),
onDropdownVisibleChange: unref(handleVisibleChange)
}), null, 16, ["value", "field-names", "options", "class", "load-data", "onChange", "onDropdownVisibleChange"]);
};
}
});
export {
_sfc_main as default
};