mirror of https://github.com/vuejs/vue.git
parent
34333caa8c
commit
974247fd8e
|
|
@ -178,7 +178,7 @@ export function renderMixin (Vue: Class<Component>) {
|
|||
render: () => VNode
|
||||
): ?Array<VNode> {
|
||||
let ret: ?Array<VNode>, i, l, keys, key
|
||||
if (Array.isArray(val)) {
|
||||
if (Array.isArray(val) || typeof val === 'string') {
|
||||
ret = new Array(val.length)
|
||||
for (i = 0, l = val.length; i < l; i++) {
|
||||
ret[i] = render(val[i], i)
|
||||
|
|
|
|||
|
|
@ -428,4 +428,22 @@ describe('Directive v-for', () => {
|
|||
expect(vm.$el.textContent).toMatch(/\s+foo\s+bar\s+/)
|
||||
}).then(done)
|
||||
})
|
||||
|
||||
it('strings', done => {
|
||||
const vm = new Vue({
|
||||
data: {
|
||||
text: 'foo'
|
||||
},
|
||||
template: `
|
||||
<div>
|
||||
<span v-for="letter in text">{{ letter }}.</span
|
||||
</div>
|
||||
`
|
||||
}).$mount()
|
||||
expect(vm.$el.textContent).toMatch('f.o.o.')
|
||||
vm.text += 'bar'
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toMatch('f.o.o.b.a.r.')
|
||||
}).then(done)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue