Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 7x 7x 28x 28x 28x 28x 28x 44x 28x 28x | <script> import { Hooks } from "../libs/hooks"; import Formulate from "@braid/vue-formulate"; export default { extends: Formulate.defaults.components.FormulateInput, props: { modelHook: { type: [Function, Object, Array], default: null } }, watch: { "context.model": { handler(newModel, oldModel) { const _modelHook = new Hooks(); I if (Array.isArray(this.modelHook)) { this.modelHook.map(m => _modelHook.addHook(m)); I } else if (typeof this.modelHook === "function") { _modelHook.addHook({ handler: this.modelHook }); } else { _modelHook.addHook(this.modelHook); } const defaultModelHooks = this.$formulate.options.hooks && this.$formulate.options.hooks.model ? this.$formulate.options.hooks.model : []; defaultModelHooks.map(h => _modelHook.addHook(h)); E if (newModel !== oldModel) { this.context.model = _modelHook.apply(newModel, { oldModel, context: this.context }); } } } } }; </script> |