mt-ui-components-vue3
Version:
玛果添实UI组件库(Vue3)
63 lines • 2.3 kB
JavaScript
/* Analyzed bindings: {
"filter": "props",
"computed": "setup-const",
"inject": "setup-const",
"ref": "setup-const",
"watch": "setup-const",
"defaultOptions": "setup-maybe-ref",
"selectProps": "setup-maybe-ref",
"JSelect": "setup-maybe-ref",
"FULL_CODE": "setup-maybe-ref",
"emit": "setup-const",
"props": "setup-reactive-const",
"_value": "setup-ref",
"_options": "setup-ref",
"fullRef": "setup-maybe-ref",
"change": "setup-const"
} */
import { defineComponent as _defineComponent } from 'vue';
import { unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createBlock as _createBlock } from "vue";
import { computed, inject, ref, watch } from 'vue';
import defaultOptions from './data';
import { selectProps } from 'ant-design-vue/lib/select';
import { Select as JSelect } from '../../../components';
import { FULL_CODE } from '../../index';
const __sfc_main__ = _defineComponent({
props: {
...selectProps(),
filter: {
type: [Array],
default: () => [],
},
},
emits: ['update:value'],
setup(__props, { emit }) {
const props = __props;
const _value = ref(props.value);
const _options = computed(() => {
return props.filter.length
? defaultOptions.filter((item) => !props.filter.includes(item.value))
: defaultOptions;
});
const fullRef = inject(FULL_CODE);
const change = (key) => {
_value.value = key;
emit('update:value', key);
};
watch(() => props.value, () => {
_value.value = props.value;
});
return (_ctx, _cache) => {
return (_openBlock(), _createBlock(_unref(JSelect), _mergeProps(props, {
value: _value.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => ((_value).value = $event)),
style: { "width": "100%" },
placeholder: "请选择数据类型",
options: _options.value,
"get-popup-container": (node) => _unref(fullRef) || node,
onChange: change
}), null, 16 /* FULL_PROPS */, ["value", "options", "get-popup-container"]));
};
}
});
export default __sfc_main__;