Feature request: proxy-based version of reactive
bendytree opened this issue · comments
For me, the most exciting thing in Vue 3 is reactivity without "touching" properties first and without the Vue.set
noise.
We're using Vue 2 for a new project - mainly because Vuetify doesn't support Vue 3 yet. IE 11 is 6% of our audience & reaches EOL next summer, so we're ok dropping support. Every other browser supports Proxy
.
So I'm wondering if there'd be any interest in a Proxy based version of reactive
. e.g.
import { proxied } from '@vue/composition-api';
const user = proxied({});
user.name = 'Foo'; // Reactive!
Here's a proof of concept in case it's helpful:
https://codesandbox.io/s/kklqn?file=/index.js
For anyone interested - I took a shot:
https://github.com/bendytree/vue-composition-api-proxied
Usage is:
import { proxied } from 'vue-composition-api-proxied';
const user = proxied({});
user.name = 'Foo'; // Reactive!
Works on nested objects/arrays. PRs/feedback welcome. Would love to see something like this in @vue/composition-api
Unfortunately @vue/composition-api
does support IE like Vue 2, so using a Proxy
is simply not possible.
Thanks @posva - I certainly understand.
Just to clarify - the intent is an opt-in version of reactive
. Groups supporting IE11 would not be impacted - they would simply not use it. I'm guessing there are many who are stuck on Vue 2 - not necessarily because they need IE11 support - especially since IE 11 is near EOL.