UNPKG

vue-admin-core

Version:
37 lines (34 loc) 990 B
import { ElSwitch } from 'element-plus'; import { defineComponent, ref, h } from 'vue'; import { observer } from '@formily/reactive-vue'; import { omit } from 'lodash-es'; const InnerElSwitch = observer( defineComponent({ name: "FSwitch", props: { ...ElSwitch.props }, setup(props, { attrs }) { const loading = ref(); return () => { return h(ElSwitch, { ...omit(props, ["value"]), ...omit(attrs, ["value"]), modelValue: props.value, loading: loading.value || props.loading, // @ts-ignore beforeChange: async (value) => { var _a; loading.value = true; const res = await ((_a = props.beforeChange) == null ? void 0 : _a.call(props, value)); loading.value = false; return res; } }); }; } }) ); const Switch = InnerElSwitch; export { Switch, Switch as default }; //# sourceMappingURL=index.mjs.map