-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specifying the deep/immediate flags on watches is awkward #31
Comments
I think it's a great idea. What about just adding the flags without additional punctuation? 'on:foo.bar.baz deep immediate' |
On top of (imo) reducing the chances of conflicts, I feel like the pound sign syntax is easier to read.
|
The pound and commas don't feel particularly idiomatic with respect to Vue. Maybe something like this...
|
Oh, yeah that would work. Similar to |
Pretty much exactly like Vue's directive syntax! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
Currently, defining a watcher with either the
deep
orimmediate
flags requires a watch property with an object value that specifies the handler and flags. This is awkward and breaks type checking becausethis
isn't defined.That's in the Vue 2 branch. Due to the way the watches are created in the Vue 3 branch, setting those flags is impossible so your only option is to manually call
watch
yourself.Proposal
I propose a suffix syntax for setting these flags. The flags would be defined, comma-separated, after a pound sign. e.g.
'on:prop#deep'
or'on:prop#deep,immediate'
.In Vue 2 the only flags will be
deep
andimmediate
. Vue 3 adds theflush
watch option, which adds three more (mutually exclusive) flags:pre
,post
, andsync
.The text was updated successfully, but these errors were encountered: