UNPKG

@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

30 lines (26 loc) 761 B
import extend from '@caxa-form/utils/lib/extend'; export default function useRender(Handler) { extend(Handler.prototype, { clearNextTick() { this.nextTick && clearTimeout(this.nextTick); this.nextTick = null; }, bindNextTick(fn) { this.clearNextTick(); this.nextTick = setTimeout(() => { fn() this.nextTick = null; }, 10); }, render() { // console.warn('%c render', 'color:green'); ++this.loadedId; if (this.vm.unique > 0) return this.$render.render(); else { this.vm.unique = 1; return []; } }, }); }