Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev
Choose a base ref
...
head repository: mejustme/vue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dev
Choose a head ref

There isn’t anything to compare.

vuejs:dev and mejustme:dev are entirely different commit histories.

Showing with 22 additions and 1 deletion.
  1. +3 −1 src/compiler/compile-props.js
  2. +19 −0 test/unit/specs/directives/internal/prop_spec.js
4 changes: 3 additions & 1 deletion src/compiler/compile-props.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import config from '../config'
import { parseDirective } from '../parsers/directive'
import { isSimplePath } from '../parsers/expression'
import { defineReactive } from '../observer/index'
import propDef from '../directives/internal/prop'
import {
@@ -221,7 +222,8 @@ export function initProp (vm, prop, value) {
value = getPropDefaultValue(vm, prop.options)
}
if (assertProp(prop, value)) {
defineReactive(vm, key, value, true /* doNotObserve */)
var doNotObserve = !prop.dynamic || isSimplePath(prop.raw)
defineReactive(vm, key, value, doNotObserve)
}
}

19 changes: 19 additions & 0 deletions test/unit/specs/directives/internal/prop_spec.js
Original file line number Diff line number Diff line change
@@ -700,4 +700,23 @@ describe('prop', function () {
done()
})
})

it('inline prop values should be converted', function (done) {
var vm = new Vue({
el: el,
template: '<comp :a="[1, 2, 3]"></comp>',
components: {
comp: {
props: ['a'],
template: '<div v-for="i in a">{{ i }}</div>'
}
}
})
expect(vm.$el.textContent).toBe('123')
vm.$children[0].a.pop()
Vue.nextTick(function () {
expect(vm.$el.textContent).toBe('12')
done()
})
})
})