Replies: 6 comments 3 replies
-
|
I've actually thought about this, but Something like |
Beta Was this translation helpful? Give feedback.
-
|
It's not more cryptic than $$ stuff from reactivity transform // reactivity transform
let count = $ref(0)
trackChange($$(count))
// .value replacement
const count = ref(0);
doSomething(count.$)Another reason is that it's easily searchable (searching for |
Beta Was this translation helpful? Give feedback.
-
That is why it should be a shortcut. |
Beta Was this translation helpful? Give feedback.
-
|
duck不必 |
Beta Was this translation helpful? Give feedback.
-
|
FYI I moved this to RFCs discussions. |
Beta Was this translation helpful? Give feedback.
-
|
My vote is a no. This is cryptic and introduces 2 different names for the same thing. I have written plenty of code with
I would love to see some real numbers before this is used as an argument, because I doubt it'd make a significant difference, especially not after gzip.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What problem does this feature solve?
To access the value of a
ref()you use.value. While.valueis very explicit it is maybe also too long? I suggest adding a.vshortcut for.value.The use case for
.vis the same as.valuebut just a neat shortcut. I think this will improve the end user experience because you have to do less typing. Shortcuts can make using a framework more enjoyable just like the : shortcut for v-bind and @ for v-on.I also think it is nice because the framework is called Vue and then access the
.vattribute the whole time. But it should also make bundle sizes smaller because.vis 5 times as less text than.valueand this might make a difference if you have a large project.I think
.vstill makes it as clear what you are doing as.valuebut it is just much faster and nicer to type.What does the proposed API look like?
Here is are two examples:
You could also mix them:
Beta Was this translation helpful? Give feedback.
All reactions