Subscribe on changes!

compued can not destruction

avatar
May 28th 2021

Version

3.1.0-beta.5

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8YnV0dG9uIEBjbGljaz1cImxuaWsxLnErK1wiPmxuaWsxLnEge3sgbG5pazEucSB9fTwvYnV0dG9uPlxuICA8YnV0dG9uPmxuaWsxLmFkZDEge3sgbG5pazEuYWRkMSB9fTwvYnV0dG9uPlxuICA8YnV0dG9uPmxuaWsxLmFkZDIge3sgbG5pazEuYWRkMiB9fTwvYnV0dG9uPlxuICAtLVxuICA8YnV0dG9uIEBjbGljaz1cImxuaWsyLnErK1wiPmxuaWsyLnEge3sgbG5pazIucSB9fTwvYnV0dG9uPlxuICA8YnV0dG9uPmxuaWsyLmFkZDIge3sgbG5pazIucHJvcHMuYWRkMSB9fTwvYnV0dG9uPlxuICA8YnV0dG9uPmxuaWsyLmFkZDMge3sgbG5pazIucHJvcHMuYWRkMiB9fTwvYnV0dG9uPlxuICAtLVxuICA8IS0tIHRoaXMgd2lsbCBlcnJvciwgcGxlYXNlIFR1cm4gT24gIE1hbnVhbGx5IC0tPlxuICA8IS0tIDxidXR0b24gQGNsaWNrPVwibG5pazMucSsrXCI+bG5pazMucSB7eyBsbmlrMy5xIH19PC9idXR0b24+XG4gIDxidXR0b24+bG5pazMuYWRkMSB7eyBsbmlrMy5hZGQxIH19PC9idXR0b24+XG4gIDxidXR0b24+bG5pazMuYWRkMiB7eyBsbmlrMy5hZGQyIH19PC9idXR0b24+IC0tPlxuPC90ZW1wbGF0ZT5cblxuPHNjcmlwdCBzZXR1cD5cbmltcG9ydCB7IGNvbXB1dGVkLCByZWFjdGl2ZSB9IGZyb20gXCJ2dWVcIlxuXG5cbnZhciBsbmlrMSA9IHJlYWN0aXZlKHtcbiAgcTogMSxcbiAgYWRkMTogY29tcHV0ZWQoKCkgPT4gbG5pazEucSArIDEpLFxuICBhZGQyOiBjb21wdXRlZCgoKSA9PiBsbmlrMS5xICsgMiksXG59KVxuXG52YXIgbG5pazIgPSByZWFjdGl2ZSh7XG4gIHE6IDEsXG4gIHByb3BzOiBjb21wdXRlZCgoKSA9PiAoeyBhZGQxOiBsbmlrMi5xICsgMSwgYWRkMjogbG5pazIucSArIDIgfSkpLFxufSlcblxuLy8gdGhpcyB3aWxsIGVycm9yLCBwbGVhc2UgVHVybiBPbiAgTWFudWFsbHlcbi8vIHZhciBsbmlrMyA9IHJlYWN0aXZlKHtcbi8vICAgcTogMSxcbi8vICAgLi4uY29tcHV0ZWQoKCkgPT4gKHsgYWRkMTogbG5pazMucSArIDEsIGFkZDI6IGxuaWszLnEgKyAyIH0pKSxcbi8vIH0pXG48L3NjcmlwdD5cblxuIn0=

Steps to reproduce

first, as link 1 code, i have lots of computed

so as link 2 Combine them into one

last, link 3 i want take out props, but get error

What is expected?

work

What is actually happening?

can not work

avatar
May 28th 2021

The return value from computed is a computed ref. It's not the object your returned.

It is unwrapped automatically when you access it as a property of a reactive object, but you can't spread it.