Răsfoiți Sursa

also ignore properties that start with `_`

Evan You 12 ani în urmă
părinte
comite
b3c6ce7038
2 a modificat fișierele cu 3 adăugiri și 2 ștergeri
  1. 2 1
      src/compiler.js
  2. 1 1
      src/exp-parser.js

+ 2 - 1
src/compiler.js

@@ -72,7 +72,8 @@ function Compiler (vm, options) {
 
     // create bindings for keys set on the vm by the user
     for (var key in vm) {
-        if (key.charAt(0) !== '$') {
+        key = key.charAt(0)
+        if (key !== '$' && key !== '_') {
             compiler.createBinding(key)
         }
     }

+ 1 - 1
src/exp-parser.js

@@ -50,7 +50,7 @@ module.exports = {
             hash[v] = v
             // push assignment
             args.push(v + (
-                v.charAt(0) === '$'
+                (v.charAt(0) === '$' || v.charAt(0) === '_')
                     ? '=this.' + v
                     : '=this.$get("' + v + '")'
                 ))