diff --git a/src/components/form/form-item.vue b/src/components/form/form-item.vue index 17fb988..1fc2019 100644 --- a/src/components/form/form-item.vue +++ b/src/components/form/form-item.vue @@ -92,6 +92,7 @@ this.validateState = val; } }, + inject: ['form'], computed: { classes () { return [ @@ -103,13 +104,13 @@ } ]; }, - form() { - let parent = this.$parent; - while (parent.$options.name !== 'iForm') { - parent = parent.$parent; - } - return parent; - }, + // form() { + // let parent = this.$parent; + // while (parent.$options.name !== 'iForm') { + // parent = parent.$parent; + // } + // return parent; + // }, fieldValue: { cache: false, get() { diff --git a/src/components/form/form.vue b/src/components/form/form.vue index 477b08f..57b284a 100644 --- a/src/components/form/form.vue +++ b/src/components/form/form.vue @@ -40,6 +40,9 @@ default: 'off' } }, + provide() { + return { form : this }; + }, data () { return { fields: [] -- libgit2 0.21.4