vue-admin-core
Version:
A Component Library for Vue 3
42 lines (37 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var elementPlus = require('element-plus');
var vue = require('vue');
var reactiveVue = require('@formily/reactive-vue');
var lodashEs = require('lodash-es');
const InnerElSwitch = reactiveVue.observer(
vue.defineComponent({
name: "FSwitch",
props: {
...elementPlus.ElSwitch.props
},
setup(props, { attrs }) {
const loading = vue.ref();
return () => {
return vue.h(elementPlus.ElSwitch, {
...lodashEs.omit(props, ["value"]),
...lodashEs.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;
exports.Switch = Switch;
exports.default = Switch;
//# sourceMappingURL=index.js.map