TypeError: Cannot read properties of null (reading ‘parentNode‘) vue3踩坑

 Solution 1: If the declared constant uses ref, check whether the assignment and the assigned value correspond to each other.

 

 As shown in the picture above, I assign a value to an object, and if I write this directly, the error in the first picture above will be reported.

Correction: change ref() to ref({})

 Solution 2: If you use reactive

Then use Object.assign(a, b), the first a is assigned, and the second has data

 

Learn about Object.assign() at Object.assign() - JavaScript | MDN (mozilla.org)

 

 

Guess you like

Origin blog.csdn.net/weixin_57997644/article/details/130475766