瀏覽代碼

warn deprecated is="{{view}}" syntax

Evan You 10 年之前
父節點
當前提交
54c1cfc24d
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 7 0
      src/deprecations.js
  2. 3 0
      src/util/component.js

+ 7 - 0
src/deprecations.js

@@ -149,6 +149,13 @@ if (process.env.NODE_ENV !== 'production') {
         'Computed property "' + name + '": computed properties are not cached by ' +
         'default in 1.0.0. You only need to enable cache for particularly expensive ones.'
       )
+    },
+
+    BIND_IS: function () {
+      warn(
+        '<component is="{{view}}"> syntax will be depreacted in 1.0.0. Use ' +
+        '<component bind-is="view"> instead.'
+      )
     }
 
   }

+ 3 - 0
src/util/component.js

@@ -16,6 +16,9 @@ exports.checkComponent = function (el, options) {
     // dynamic syntax
     var exp = el.getAttribute('is')
     if (exp != null) {
+      if (process.env.NODE_ENV !== 'production' && /{{.*}}/.test(exp)) {
+        _.deprecation.BIND_IS()
+      }
       el.removeAttribute('is')
     } else {
       exp = el.getAttribute('bind-is')