You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script>
import { ref, reactive, defineComponent } from'vue';exportdefaultdefineComponent({// other optionssetup () {constu=ref(10);constv=ref(20);constobj=reactive({ u, v });obj.u= v; // This line causes the bug }})
</script>
What did you expect to happen?
According to the Vue docs, on the topic "Access in Reactive Objects", "if a new ref is assigned to a property linked to an existing ref, it will replace the old ref", and there's this example
So, ESLint shouldn't complain about the assignment obj.u = v.
What actually happened?
ESLint throws this
62:17 error Must use `.value` to read or write the value wrapped by `ref()` vue/no-ref-as-operand
✖ 1 problem (1 error, 0 warnings)
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/App.vue?vue&type=script&lang=js 1:0-37 5:10-14
@ ./src/App.vue?vue&type=script&lang=js
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.0.97:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
It's not ideal to assign obj.u = v.value since it will cause the loss of the reactivity link from the ref to the reactive object.
Repository to reproduce this issue
Copying the code provided here in an existent Vue project should be enough to reproduce this one.
The text was updated successfully, but these errors were encountered:
Checklist
Tell us about your environment
Please show your full configuration:
Configuration inside package.json, just the defaults for Vue 3 + CLI
What did you do?
What did you expect to happen?
According to the Vue docs, on the topic "Access in Reactive Objects", "if a new ref is assigned to a property linked to an existing ref, it will replace the old ref", and there's this example
So, ESLint shouldn't complain about the assignment
obj.u = v
.What actually happened?
ESLint throws this
It's not ideal to assign
obj.u = v.value
since it will cause the loss of the reactivity link from the ref to the reactive object.Repository to reproduce this issue
Copying the code provided here in an existent Vue project should be enough to reproduce this one.
The text was updated successfully, but these errors were encountered: