You’re browsing the documentation for Vue Test Utils for Vue v2.x and earlier.
To read docs for Vue Test Utils for Vue 3, click here.
findAll
废弃警告
使用 findAll 搜索组件的方式已经被废弃并会被移除。请换用 findAllComponents。
返回一个 WrapperArray。
可以使用任何有效的选择器。
参数:
{string|Component} selector
返回值:
{WrapperArray}示例:
import { mount } from '@vue/test-utils'
import Foo from './Foo.vue'
import Bar from './Bar.vue'
const wrapper = mount(Foo)
const div = wrapper.findAll('div').at(0)
expect(div.is('div')).toBe(true)
const bar = wrapper.findAll(Bar).at(0) // 已废弃的用法
expect(bar.is(Bar)).toBe(true)