Evan You пре 9 година
родитељ
комит
03043b9081

+ 9 - 4
src/compiler/parser/index.js

@@ -391,10 +391,15 @@ function processAttrs (el) {
       if (bindRE.test(name)) { // v-bind
         name = name.replace(bindRE, '')
         value = parseFilters(value)
-        if (modifiers && modifiers.prop) {
-          isProp = true
-          name = camelize(name)
-          if (name === 'innerHtml') name = 'innerHTML'
+        if (modifiers) {
+          if (modifiers.prop) {
+            isProp = true
+            name = camelize(name)
+            if (name === 'innerHtml') name = 'innerHTML'
+          }
+          if (modifiers.camel) {
+            name = camelize(name)
+          }
         }
         if (isProp || platformMustUseProp(el.tag, name)) {
           addProp(el, name, value)

+ 1 - 1
test/unit/features/component/component-scoped-slot.spec.js

@@ -1,6 +1,6 @@
 import Vue from 'vue'
 
-fdescribe('Component scoped slot', () => {
+describe('Component scoped slot', () => {
   it('default slot', done => {
     const vm = new Vue({
       template: `

+ 11 - 1
test/unit/features/directives/bind.spec.js

@@ -109,7 +109,7 @@ describe('Directive v-bind', () => {
     }).then(done)
   })
 
-  it('bind as prop', () => {
+  it('.prop modifier', () => {
     const vm = new Vue({
       template: '<div><span v-bind:text-content.prop="foo"></span><span :inner-html.prop="bar"></span></div>',
       data: {
@@ -121,6 +121,16 @@ describe('Directive v-bind', () => {
     expect(vm.$el.children[1].innerHTML).toBe('<span>qux</span>')
   })
 
+  it('.camel modifier', () => {
+    const vm = new Vue({
+      template: '<svg :view-box.camel="viewBox"></svg>',
+      data: {
+        viewBox: '0 0 1 1'
+      }
+    }).$mount()
+    expect(vm.$el.getAttribute('viewBox')).toBe('0 0 1 1')
+  })
+
   it('bind object', done => {
     const vm = new Vue({
       template: '<input v-bind="test">',