Skip to content

Commit

Permalink
fix(compiler-core): should alias name in helperString (#743)
Browse files Browse the repository at this point in the history
fix #740
  • Loading branch information
underfin authored Feb 19, 2020
1 parent 478b4cf commit 7b987d9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-core/__tests__/transforms/vBind.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('compiler: transform v-bind', () => {
expect(props.properties[0]).toMatchObject({
key: {
children: [
`${helperNameMap[CAMELIZE]}(`,
`_${helperNameMap[CAMELIZE]}(`,
{ content: `_ctx.foo` },
`(`,
{ content: `_ctx.bar` },
Expand Down
5 changes: 1 addition & 4 deletions packages/compiler-core/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ export function createTransformContext(
return name
},
helperString(name) {
return (
(context.prefixIdentifiers ? `` : `_`) +
helperNameMap[context.helper(name)]
)
return `_${helperNameMap[context.helper(name)]}`
},
replaceNode(node) {
/* istanbul ignore if */
Expand Down
1 change: 0 additions & 1 deletion packages/compiler-core/src/transforms/transformElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ function buildDirectiveArgs(
const dirArgs: ArrayExpression['elements'] = []
const runtime = directiveImportMap.get(dir)
if (runtime) {
context.helper(runtime)
dirArgs.push(context.helperString(runtime))
} else {
// inject statement for resolving directive
Expand Down

3 comments on commit 7b987d9

@jods4
Copy link
Contributor

@jods4 jods4 commented on 7b987d9 Feb 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@underfin am I correct thinking that this fixes "vModelCheckbox is undefined" when doing <input type=checkbox v-model=x>?
The import is _vModelCheckbox I guess and it seems to work on template explorer.

If so, could you please publish an alpha.6? This is a pretty bad bug. 🙁

@underfin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.But I can not publish version beacause I do not have permission for this.

@jods4
Copy link
Contributor

@jods4 jods4 commented on 7b987d9 Feb 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyx990803 Could you publish an alpha.6 with this fix please?
Not being able to use v-model on checkboxes is annoying.

Please sign in to comment.