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

This commit is contained in:
Evan You 2016-08-16 14:52:23 -04:00
parent e96529844e
commit 8e1478e30d
1 changed files with 4 additions and 4 deletions

View File

@ -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
}
}