mirror of https://github.com/vuejs/core.git
fix(compiler-vapor): should not prefix member expression (#92)
This commit is contained in:
parent
2cce436aaf
commit
8d7d672bc5
|
@ -226,6 +226,18 @@ export function render(_ctx) {
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`v-on > should not prefix member expression 1`] = `
|
||||||
|
"import { template as _template, children as _children, on as _on } from 'vue/vapor';
|
||||||
|
|
||||||
|
export function render(_ctx) {
|
||||||
|
const t0 = _template("<div></div>")
|
||||||
|
const n0 = t0()
|
||||||
|
const { 0: [n1],} = _children(n0)
|
||||||
|
_on(n1, "click", (...args) => (_ctx.foo.bar && _ctx.foo.bar(...args)))
|
||||||
|
return n0
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`v-on > should not wrap keys guard if no key modifier is present 1`] = `
|
exports[`v-on > should not wrap keys guard if no key modifier is present 1`] = `
|
||||||
"import { template as _template, children as _children, on as _on, withModifiers as _withModifiers } from 'vue/vapor';
|
"import { template as _template, children as _children, on as _on, withModifiers as _withModifiers } from 'vue/vapor';
|
||||||
|
|
||||||
|
|
|
@ -707,4 +707,15 @@ describe('v-on', () => {
|
||||||
'(_ctx.event) === "click" ? "mouseup" : (_ctx.event)',
|
'(_ctx.event) === "click" ? "mouseup" : (_ctx.event)',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('should not prefix member expression', () => {
|
||||||
|
const { code } = compileWithVOn(`<div @click="foo.bar"/>`, {
|
||||||
|
prefixIdentifiers: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(code).matchSnapshot()
|
||||||
|
expect(code).contains(
|
||||||
|
`_on(n1, "click", (...args) => (_ctx.foo.bar && _ctx.foo.bar(...args)))`,
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -652,7 +652,7 @@ function genExpression(
|
||||||
if (isLocal) return
|
if (isLocal) return
|
||||||
ids.push(id)
|
ids.push(id)
|
||||||
},
|
},
|
||||||
true,
|
false,
|
||||||
[],
|
[],
|
||||||
knownIds,
|
knownIds,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue