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

handle include/exclude changing to non-valid types (fix #4749)

Evan You 9 лет назад
Родитель
Сommit
458671b732
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/core/components/keep-alive.js

+ 2 - 1
src/core/components/keep-alive.js

@@ -12,9 +12,10 @@ function getComponentName (opts: ?VNodeComponentOptions): ?string {
 function matches (pattern: string | RegExp, name: string): boolean {
   if (typeof pattern === 'string') {
     return pattern.split(',').indexOf(name) > -1
-  } else {
+  } else if (pattern instanceof RegExp) {
     return pattern.test(name)
   }
+  return false
 }
 
 function pruneCache (cache, filter) {