我正在为VueJS编写一个测试,我想访问HTML的最外层。然而,无论我使用什么方法,最外层总是被忽略。无论如何,我可以访问这个最外层,然后用它做一些事情(例如,outermostLayer.removeAttribute('key'))
const originalHTML = ''; const component = { template: originalHTML }; const wrapper = mount(component); await flushPromises(); console.log(wrapper.element.querySelector('main')); // only return the inner main console.log(wrapper.element.getElementsByTagName('main')); //only the inner one content
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号