mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 21:17:55 +08:00
adjust binding attr retrieval priority
This commit is contained in:
parent
69abe1b726
commit
20f6e6e3fe
@ -70,14 +70,21 @@ export function getBindingAttr (
|
||||
el: ASTElement,
|
||||
name: string,
|
||||
getStatic?: boolean
|
||||
) {
|
||||
const staticValue = getStatic !== false && getAndRemoveAttr(el, name)
|
||||
return staticValue || staticValue === ''
|
||||
? JSON.stringify(staticValue)
|
||||
: (getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name))
|
||||
): ?string {
|
||||
const dynamicValue =
|
||||
getAndRemoveAttr(el, ':' + name) ||
|
||||
getAndRemoveAttr(el, 'v-bind:' + name)
|
||||
if (dynamicValue != null) {
|
||||
return dynamicValue
|
||||
} else if (getStatic !== false) {
|
||||
const staticValue = getAndRemoveAttr(el, name)
|
||||
if (staticValue != null) {
|
||||
return JSON.stringify(staticValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getAndRemoveAttr (el: ASTElement, name: string) {
|
||||
export function getAndRemoveAttr (el: ASTElement, name: string): ?string {
|
||||
let val
|
||||
if ((val = el.attrsMap[name]) != null) {
|
||||
el.attrsMap[name] = null
|
||||
|
Loading…
Reference in New Issue
Block a user