@caxa-form/core
Version:
vue动态表单,助你轻松搞定表单|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 3 UI frameworks, and supports the generation of any Vue components. Built-in 20
26 lines (23 loc) • 718 B
JavaScript
import extend from '@caxa-form/utils/lib/extend';
import is from '@caxa-form/utils/lib/type';
import {invoke} from '../frame/util';
export default function useLifecycle(Handler) {
extend(Handler.prototype, {
mounted() {
const _mounted = () => {
this.isMounted = true;
this.lifecycle('mounted');
}
if (this.pageEnd) {
_mounted();
} else {
this.bus.$once('page-end', _mounted);
}
},
lifecycle(name) {
const fn = this.options[name];
is.Function(fn) && invoke(() => fn(this.api));
this.vm.$emit(name, this.api);
},
})
}