Subscribe on changes!

HTMLDivElement not reactive in computed property

avatar
Oct 15th 2020

Version

3.0.0

Reproduction link

https://jsfiddle.net/ljcremer/uLjd85va/159/

Steps to reproduce

Run the application and then change the width of the fiddle run section.

What is expected?

I expect the computed property computedWidth to change reactively

What is actually happening?

It does not change reactively


I first tried with ref but the same symptom. Also tried to use the recommended method in https://github.com/vuejs/vue-next/issues/901 but still no luck

avatar
Oct 15th 2020

dom properties are not reactive

avatar
Oct 15th 2020

This is expected behavior. Vue does not observe native DOM elements. Only plain userland objects can be made reactive.