Переглянути джерело

change two-way binding indicator from @ to &

Evan You 10 роки тому
батько
коміт
31757569b9

+ 1 - 1
examples/modal/index.html

@@ -57,7 +57,7 @@
     <div id="app">
       <button id="show-modal" @click="showModal = true">Show Modal</button>
       <!-- use the modal component, pass in the prop -->
-      <modal :show@="showModal">
+      <modal :show&="showModal">
         <!--
           you can use custom content here to overwrite
           default content

+ 1 - 1
src/compiler/compile-props.js

@@ -57,7 +57,7 @@ module.exports = function compileProps (el, propOptions) {
 
       // then check dynamic version
       if ((value = _.getBindAttr(el, attr)) === null) {
-        if ((value = _.getBindAttr(el, attr + '@')) !== null) {
+        if ((value = _.getBindAttr(el, attr + '&')) !== null) {
           prop.mode = propBindingModes.TWO_WAY
         } else if ((value = _.getBindAttr(el, attr + '*')) !== null) {
           prop.mode = propBindingModes.ONE_TIME

+ 3 - 5
src/parsers/text.js

@@ -57,7 +57,7 @@ exports.parse = function (text) {
   }
   var tokens = []
   var lastIndex = tagRE.lastIndex = 0
-  var match, index, html, value, first, oneTime, twoWay
+  var match, index, html, value, first, oneTime
   /* eslint-disable no-cond-assign */
   while (match = tagRE.exec(text)) {
   /* eslint-enable no-cond-assign */
@@ -73,16 +73,14 @@ exports.parse = function (text) {
     value = html ? match[1] : match[2]
     first = value.charCodeAt(0)
     oneTime = first === 42 // *
-    twoWay = first === 64  // @
-    value = oneTime || twoWay
+    value = oneTime
       ? value.slice(1)
       : value
     tokens.push({
       tag: true,
       value: value.trim(),
       html: html,
-      oneTime: oneTime,
-      twoWay: twoWay
+      oneTime: oneTime
     })
     lastIndex = index + match[0].length
   }

+ 2 - 2
test/unit/specs/compiler/compile_spec.js

@@ -230,8 +230,8 @@ if (_.inBrowser) {
         'v-bind:test-normal="a" ' +
         'test-literal="1" ' +
         ':optimize-literal="1" ' +
-        ':test-two-way@="a" ' +
-        ':two-way-warn@="a + 1" ' +
+        ':test-two-way&="a" ' +
+        ':two-way-warn&="a + 1" ' +
         ':test-one-time*="a"></div>'
       compiler.compileAndLinkProps(vm, el.firstChild, props)
       expect(vm._bindDir.calls.count()).toBe(3) // skip literal and one time

+ 3 - 3
test/unit/specs/directives/internal/prop_spec.js

@@ -73,7 +73,7 @@ if (_.inBrowser) {
             a: 'A'
           }
         },
-        template: '<test v-bind:testt@="test" :bb@="b" :a@=" test.a " $.child></test>',
+        template: '<test v-bind:testt&="test" :bb&="b" :a&=" test.a " $.child></test>',
         components: {
           test: {
             props: ['testt', 'bb', 'a'],
@@ -145,7 +145,7 @@ if (_.inBrowser) {
         data: {
           b: 'B'
         },
-        template: '<test :b@=" b + \'B\'" $.child></test>',
+        template: '<test :b&=" b + \'B\'" $.child></test>',
         components: {
           test: {
             props: ['b'],
@@ -248,7 +248,7 @@ if (_.inBrowser) {
           a: 'A',
           b: 'B'
         },
-        template: '<test :aa@="a" :bb="b"></test>',
+        template: '<test :aa&="a" :bb="b"></test>',
         components: {
           test: {
             props: ['aa', 'bb'],