Kaynağa Gözat

fix deprecation warning heuristics

Evan You 10 yıl önce
ebeveyn
işleme
490ab69e45
2 değiştirilmiş dosya ile 10 ekleme ve 6 silme
  1. 1 1
      src/compiler/transclude.js
  2. 9 5
      src/util/options.js

+ 1 - 1
src/compiler/transclude.js

@@ -30,7 +30,7 @@ exports.transclude = function (el, options) {
   }
   if (options) {
     if (options._asComponent && !options.template) {
-      options.template = '<content></content>'
+      options.template = '<slot></slot>'
     }
     if (options.template) {
       options._content = _.extractContent(el)

+ 9 - 5
src/util/options.js

@@ -352,11 +352,8 @@ exports.resolveAsset = function resolve (options, type, id) {
   var assets = options[type]
   var asset = assets[id] || assets[camelizedId] || assets[pascalizedId]
 
-  if (process.env.NODE_ENV !== 'production') {
-    if (!asset && !config.strict) {
-      _.deprecation.STRICT_MODE()
-    }
-  }
+  // for deprecation check
+  var localAsset = asset
 
   while (
     !asset &&
@@ -367,5 +364,12 @@ exports.resolveAsset = function resolve (options, type, id) {
     assets = options[type]
     asset = assets[id] || assets[camelizedId] || assets[pascalizedId]
   }
+
+  if (process.env.NODE_ENV !== 'production') {
+    if (asset && !localAsset && !config.strict) {
+      _.deprecation.STRICT_MODE()
+    }
+  }
+
   return asset
 }