-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Support v-if multiple conditions #4271
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
Conversation
…feature # Conflicts: # src/compiler/optimizer.js
…feature # Conflicts: # src/compiler/parser/index.js
Latter might be better for non-native users |
@@ -41,6 +41,7 @@ declare type ModuleOptions = { | |||
} | |||
|
|||
declare type ASTModifiers = { [key: string]: boolean } | |||
declare type ASTIfConditions = Array<{ exp: ?string; block: ASTElement }> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this doing
else?: true; | ||
elseBlock?: ASTElement; | ||
conditions?: ASTIfConditions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this
}).$mount() | ||
expect(vm.$el.innerHTML.trim()).toBe('<span>hello</span>') | ||
vm.foo = false | ||
waitForUpdate(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the waitForUpdate magic
vm.bar = true | ||
}).then(() => { | ||
expect(vm.$el.innerHTML.trim()).toBe('<span>elseif</span>') | ||
vm.bar = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it wants a then chaining,
+ expect(vm.$el.innerHTML.trim()).toBe('<span>elseif</span>')
+ vm.bar = false
should return a promise,
but I see no promise T.T
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fnlctrl help wanted XD
vm.bar = 0 | ||
}).then(() => { | ||
expect(vm.$el.innerHTML.trim()).toBe('<span>bye</span>') | ||
vm.bar = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would it be necessary for so many kind of vm.bar
@fnlctrl
Support v-if multiple conditions
Collects
if
andv-elseif
andv-else
into element.conditions when parsing and generates code like (a)?_h:(c)?_h:_e()