Skip to content

Looks like regression to .prop modifier with components in 2.3.0  #5925

Closed
@davidhewitt

Description

@davidhewitt

Version

2.3.4

Reproduction link

https://jsfiddle.net/cpfrydsh/6/

Steps to reproduce

Create a component.

Pass it some props using v-bind, and add the .prop modifier to them.

The property values appear to not be set in the component correctly (they'll just be undefined), and bad stuff occurs.

What is expected?

In vue 2.2.6 the .prop modifier didn't do this, the only observable effect was that e.g. :foo.prop="bar" wouldn't write any html attribute if "foo" wasn't a prop for the component in question.

What is actually happening?

In vue 2.3.0 the prop bound with the .prop modifier is "undefined" when accessing in the component.


I had a go at reading the docs but I couldn't find any concrete definition of how v-bind:foo.prop should interplay with components.

In vue 2.2.6 I used this because .prop would guarantee no HTML would be generated. It would be nice if either the 2.2.6 behaviour was restored or there was another modifier created to say "if this component doensn't have a prop called foo, then just ignore this binding".

e.g.

<!-- components passed as my_switchable_component don't have to take
     a "foo" prop, and if they don't, I don't want the value of "foo"
     written into the HTML -->

<component :is="my_switchable_component" :foo.prop="my_foo_value">
</component>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions