27 lines
731 B
JavaScript
27 lines
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
|