Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commit1a979c4

Browse files
jinzhubaofuyyx990803
authored andcommitted
fix(ssr): fix v-show inline style rendering when style binding is array (vuejs#7814)
fixvuejs#7813
1 parenta6169d1 commit1a979c4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎src/platforms/web/server/directives/show.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
exportdefaultfunctionshow(node:VNodeWithData,dir:VNodeDirective){
44
if(!dir.value){
55
conststyle:any=node.data.style||(node.data.style={})
6-
style.display='none'
6+
if(Array.isArray(style)){
7+
style.push({display:'none'})
8+
}else{
9+
style.display='none'
10+
}
711
}
812
}

‎test/ssr/ssr-string.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,17 @@ describe('SSR: renderToString', () => {
267267
})
268268
})
269269

270+
it('v-show directive merge with style',done=>{
271+
renderVmWithOptions({
272+
template:'<div :style="[{lineHeight: 1}]" v-show="false"><span>inner</span></div>'
273+
},res=>{
274+
expect(res).toContain(
275+
'<div data-server-rendered="true" style="line-height:1;display:none;"><span>inner</span></div>'
276+
)
277+
done()
278+
})
279+
})
280+
270281
it('v-show directive not passed to child',done=>{
271282
renderVmWithOptions({
272283
template:'<foo v-show="false"></foo>',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp