Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSR] lost v-show if style is to binding to an array #7813

Closed
jinzhubaofu opened this issue Mar 13, 2018 · 0 comments · Fixed by #7814
Closed

[SSR] lost v-show if style is to binding to an array #7813

jinzhubaofu opened this issue Mar 13, 2018 · 0 comments · Fixed by #7814

Comments

@jinzhubaofu
Copy link
Contributor

jinzhubaofu commented Mar 13, 2018

Version

2.5.15

Reproduction link

https://codepen.io/ludafa/pen/Broxxy

Steps to reproduce

  1. npm install vue vue-server-render
  2. new a index.js with this code:
const Vue = require('vue')
const app = new Vue({
  template: `<div :style="[{color: a, background: b}]" v-show="c">test</div>`,
  data() {
    return {
      a: 'red',
      b: 'blue',
      c: false
    };
  }
})
const renderer = require('vue-server-renderer').createRenderer()
renderer.renderToString(app, (err, html) => {
  if (err) throw err
  console.log(html)
})
  1. run: node index.js

What is expected?

<div data-server-rendered="true" style="color:red;background:blue;display:none;">test</div>

What is actually happening?

<div data-server-rendered="true" style="color:red;background:blue;">test</div>

Please run the CodePen on Node

@jinzhubaofu jinzhubaofu changed the title server side render lost v-show if style to binding to an array server side render lost v-show if style is to binding to an array Mar 13, 2018
@jinzhubaofu jinzhubaofu changed the title server side render lost v-show if style is to binding to an array [SSR] lost v-show if style is to binding to an array Mar 13, 2018
jinzhubaofu pushed a commit to jinzhubaofu/vue that referenced this issue Mar 13, 2018
web/server/directives/show just add style.display='none', no matter style is object or array; If
style is an array, it will lost additional property while tranformed into object in
shared/utils#toObject;

fix vuejs#7813
This was referenced Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant