Is it possible to locate a component using its key?
P粉166779363
P粉166779363 2024-03-27 10:29:18
0
1
364

Vue test-utils Does it support finding a component in a list using its key? If not, is there any other way to find components generated as a list in vue?

P粉166779363
P粉166779363

reply all(1)
P粉156415696

You cannot query a component using a key in the findComponent() method.

But you can get all the components in the list and filter them like a regular array. Just provide the correct criteria to find the item you want (using its props, properties, or other content)

const items = wrapper.findAllComponents(MyListItem)
const foundItem = items.wrappers.find(listItem => list.props('id') === 'theIdILookFor')
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!