K
K
Kirill Gladkih2019-05-08 15:11:15
1C-Bitrix
Kirill Gladkih, 2019-05-08 15:11:15

Repeating Vue components in the list of Bitrix products?

There is a product card, it is also a Bitrix component catalog.item .
Inside it, 3 Vue components are initialized - buttons: add to cart, add to compare, add to favorites.
They are related to store from vuex. As :key I specified the product id $arItem["ID"] .
And quite logically I see an error

Duplicate keys detected

I added prefixes like 10, 20, 30 to the keys (each button has its own, respectively), but this is a hard crutch.
A question for connoisseurs, is it possible to solve this problem somehow less painlessly for the eyes and conscience?
The vue instance is deployed to catalog.section.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nvdfxx, 2019-05-08
@kirill_gladkih

buttons: add to cart, add to compare, add to favorites are rendered using v-for? If not, then why do you need a key there? If you still need it, then select a 100% unique value for key, although $arItem["ID"] is sort of like an id, which by definition must be unique

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question