Отрендерите некоторые компоненты из цикла v-for. Ссылки определяются следующим образом: :ref="'category_' + index"
Вот как эти ссылки отображаются в консоли по адресу: console.log(this.$refs)
:
category_0: [VueComponent]
category_1: [VueComponent]
category_2: [VueComponent]
category_3: [VueComponent]
category_4: [VueComponent]
category_5: [VueComponent]
category_6: [VueComponent]
category_7: [VueComponent]
category_8: [VueComponent]
__proto__: Object
Если я пытаюсь получить доступ следующим образом: console.log(this.$refs.category_0)
, я получаю undefined. Любая другая определенная ссылка (не называемая «category_..») работает отлично.
Что здесь не так?
<el-form-item v-for="(category,index) in Object.Products" :key="index"
:label="category.Name">
<Select-product v-model="category.IdSelected" :ref="'category'"
ProductCategory='Ingredient' @return="handleSelectIngredient"/>
</el-form-item>
async handleSelectModelAutomat(item) { var response = await this.post("info/get", {IdModel: item}) this.Object.Products = response.Result console.log(this.$refs) console.log(this.$refs.category_0) }
- person victor vacarescu   schedule 21.03.2020