element-plus
Version:
A Component Library for Vue 3
27 lines (24 loc) • 731 B
JavaScript
import { computed } from 'vue';
import { get } from 'lodash-unified';
const defaultProps = {
label: "label",
value: "value",
disabled: "disabled",
options: "options"
};
function useProps(props) {
const aliasProps = computed(() => ({ ...defaultProps, ...props.props }));
const getLabel = (option) => get(option, aliasProps.value.label);
const getValue = (option) => get(option, aliasProps.value.value);
const getDisabled = (option) => get(option, aliasProps.value.disabled);
const getOptions = (option) => get(option, aliasProps.value.options);
return {
aliasProps,
getLabel,
getValue,
getDisabled,
getOptions
};
}
export { defaultProps, useProps };
//# sourceMappingURL=useProps.mjs.map