Skip to content

Commit

Permalink
correctly add variables to scope in m-for
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 22, 2017
1 parent e528aeb commit 4c05b2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/directives/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ specialDirectives["m-for"] = {
const params = aliases.join(",");

// Change any references to the parameters in children
code.replace(new RegExp(`instance\\.get\\("(${aliases.join("|")})"\\)`, 'g'), "$1");
code = code.replace(new RegExp(`instance\\.get\\("(${aliases.join("|")})"\\)`, 'g'), "$1");

// Use the renderLoop runtime helper
return `instance.renderLoop(${iteratable}, function(${params}) { return ${code}; })`;
Expand Down Expand Up @@ -66,8 +66,8 @@ specialDirectives["m-on"] = {

specialDirectives["m-model"] = {
beforeGenerate: function(value, meta, vnode) {
// Compile a string value for the keypath
const keypath = compileTemplateExpression(value);
// Compile a literal value for the getter
const getter = compileTemplateExpression(value);

// Setup default event types and dom property to change
let eventType = "input";
Expand Down Expand Up @@ -95,7 +95,7 @@ specialDirectives["m-model"] = {
if(dom === undefined) {
vnode.props.dom = dom = {};
}
dom[valueProp] = keypath;
dom[valueProp] = getter;
}
};

Expand Down

0 comments on commit 4c05b2f

Please sign in to comment.