我正在渲染一个动态组件:
<component :is="element.name == 'text' ? element.component : false" v-bind="elementProps"></component>
和:
computed: {
element() {
return {
name: this.elementObject.type,
component: {
components: { TextInput },
template: `<text-input :form-id="formId"
:section-id="sectionId"
:element-id="elementId"
id="test2"
></text-input>`
},
}
},
elementProps() {
const props = {
formId: this.formId,
sectionId: this.sectionId,
elementId: this.elementId,
id: this.generateId()
};
return props;
},
}
..但我得到了一个错误,Property or method "formId" is not defined on the instance but referenced during render.
虽然我传递了道具。我究竟做错了什么?