mirror of https://github.com/vuejs/vue.git
fix(ssr): fix v-show inline style rendering when style binding is array (#7814)
fix #7813
This commit is contained in:
parent
a6169d1eb7
commit
1a979c44d6
|
@ -3,6 +3,10 @@
|
|||
export default function show (node: VNodeWithData, dir: VNodeDirective) {
|
||||
if (!dir.value) {
|
||||
const style: any = node.data.style || (node.data.style = {})
|
||||
style.display = 'none'
|
||||
if (Array.isArray(style)) {
|
||||
style.push({ display: 'none' })
|
||||
} else {
|
||||
style.display = 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,6 +267,17 @@ describe('SSR: renderToString', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('v-show directive merge with style', done => {
|
||||
renderVmWithOptions({
|
||||
template: '<div :style="[{lineHeight: 1}]" v-show="false"><span>inner</span></div>'
|
||||
}, res => {
|
||||
expect(res).toContain(
|
||||
'<div data-server-rendered="true" style="line-height:1;display:none;"><span>inner</span></div>'
|
||||
)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('v-show directive not passed to child', done => {
|
||||
renderVmWithOptions({
|
||||
template: '<foo v-show="false"></foo>',
|
||||
|
|
Loading…
Reference in New Issue