Просмотр исходного кода

proxy: allow keys that start with _ to fall through (necessary for babel helpers)

Evan You 9 лет назад
Родитель
Сommit
8e1478e30d
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      src/core/instance/proxy.js

+ 4 - 4
src/core/instance/proxy.js

@@ -9,7 +9,7 @@ if (process.env.NODE_ENV !== 'production') {
     'Infinity,undefined,NaN,isFinite,isNaN,' +
     'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
     'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
-    'require,__webpack_require__' // for Webpack/Browserify
+    'require' // for Webpack/Browserify
   )
 
   hasProxy =
@@ -19,8 +19,8 @@ if (process.env.NODE_ENV !== 'production') {
   proxyHandlers = {
     has (target, key) {
       const has = key in target
-      const isAllowedGlobal = allowedGlobals(key)
-      if (!has && !isAllowedGlobal) {
+      const isAllowed = allowedGlobals(key) || key.charAt(0) === '_'
+      if (!has && !isAllowed) {
         warn(
           `Property or method "${key}" is not defined on the instance but ` +
           `referenced during render. Make sure to declare reactive data ` +
@@ -28,7 +28,7 @@ if (process.env.NODE_ENV !== 'production') {
           target
         )
       }
-      return !isAllowedGlobal
+      return has || !isAllowed
     }
   }