在vue3+Naive UI下使用Vitest取得n-input輸入值


Posted by hotmaneil on 2024-09-30

由於Naive UI有input元件,名稱為n-input,以Vitest的find和setvalue方式設值會報錯。
因此要改成如下寫法:

const wrapper = shallowMount(LayoutMenu, {

})

const inputAccount = wrapper.find('#inputAccount')
await inputAccount.element.setAttribute('value', '輸入值')

取得方式為:

 const retriveAccountValue = inputAccount.element.getAttribute('value')

特此記錄下來


#Vue #vitest #NaiveUI #n-input







Related Posts

娛樂城詐騙不要被騙,娛樂城推薦看賭豬娛樂城

娛樂城詐騙不要被騙,娛樂城推薦看賭豬娛樂城

2025娛樂城以及2025娛樂城推薦的差異性

2025娛樂城以及2025娛樂城推薦的差異性

CodeWars 解題心得 : RGB To Hex Conversion

CodeWars 解題心得 : RGB To Hex Conversion


Comments