Skip to content

:style on a custom component does not generate code using vue-server-renderer #4055

@jasonsanjose

Description

@jasonsanjose

Vue.js version

2.0.3

Reproduction Link

http://jsfiddle.net/jason_sanjose/0aat08kh/1/

Steps to reproduce

  1. Assume two custom components parent and child. In parent's template, use child with inline styles <child :style="styleComputed"></child>
  2. Render in browser
  3. Render on server
  4. Compare

What is Expected?

Inline styles should work consistently for browser and server environments.

What is actually happening?

Server does not render :style attribute on child

// Browser
<div style="...computed style..."/>

// Server
<div/>

As a workaround, in the child template, I've added :style to the root element and passed down a style as a prop, e.g.

<div :style="passthroughFromParent"/>

It's not obvious from the docs if <child :style="styleComputed"/> is valid code. I suppose an argument could be made that only custom properties defined in child should be accepted?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions