2
0
Evan You 10 жил өмнө
parent
commit
6fa757f91c

+ 7 - 0
src/compiler/compile-props.js

@@ -25,6 +25,13 @@ module.exports = function compileProps (el, propOptions) {
   while (i--) {
     options = propOptions[i]
     name = options.name
+
+    if (process.env.NODE_ENV !== 'production') {
+      if (name === '$data') {
+        _.deprecation.DATA_AS_PROP()
+      }
+    }
+
     // props could contain dashes, which will be
     // interpreted as minus calculations by the parser
     // so we need to camelize the path here

+ 17 - 2
src/deprecations.js

@@ -7,8 +7,11 @@ if (process.env.NODE_ENV !== 'production') {
 
   _.deprecation = {
 
-    REPEAT_ALIAS: function () {
-      warn('v-repeat alias (e.g. item in items) will be required in 1.0.0.')
+    REPEAT: function () {
+      warn(
+        'v-repeat will be deprecated in favor of v-for in 1.0.0. ' +
+        'See https://github.com/yyx990803/vue/issues/1200 for details.'
+      )
     },
 
     ADD: function () {
@@ -25,6 +28,18 @@ if (process.env.NODE_ENV !== 'production') {
 
     CONTENT_SELECT: function () {
       warn('<content select="..."> will be deprecated in in 1.0.0. in favor of <slot name="...">.')
+    },
+
+    DATA_AS_PROP: function () {
+      warn('$data will no longer be usable as a prop in 1.0.0.')
+    },
+
+    INHERIT: function () {
+      warn('The "inherit" option will be deprecated in 1.0.0.')
+    },
+
+    V_EL: function () {
+      warn('v-el will be deprecated in 1.0.0.')
     }
 
   }

+ 3 - 0
src/directives/el.js

@@ -3,6 +3,9 @@ module.exports = {
   isLiteral: true,
 
   bind: function () {
+    if (process.env.NODE_ENV !== 'production') {
+      require('../util').deprecation.V_EL()
+    }
     this.vm.$$[this.expression] = this.el
   },
 

+ 4 - 6
src/directives/repeat.js

@@ -36,6 +36,10 @@ module.exports = {
       )
     }
 
+    if (process.env.NODE_ENV !== 'production') {
+      _.deprecation.REPEAT()
+    }
+
     // support for item in array syntax
     var inMatch = this.expression.match(/(.*) in (.*)/)
     if (inMatch) {
@@ -45,12 +49,6 @@ module.exports = {
     // uid as a cache identifier
     this.id = '__v_repeat_' + (++uid)
 
-    if (process.env.NODE_ENV !== 'production') {
-      if (!this.arg) {
-        _.deprecation.REPEAT_ALIAS()
-      }
-    }
-
     // setup anchor nodes
     this.start = _.createAnchor('v-repeat-start')
     this.end = _.createAnchor('v-repeat-end')

+ 7 - 0
src/util/options.js

@@ -304,6 +304,13 @@ function guardArrayAssets (assets) {
  */
 
 exports.mergeOptions = function merge (parent, child, vm) {
+
+  if (process.env.NODE_ENV !== 'production') {
+    if (child.inherit) {
+      _.deprecation.INHERIT()
+    }
+  }
+
   guardComponents(child)
   guardProps(child)
   var options = {}