Skip to content

Initial inline input value #3924

@loranger

Description

@loranger

Vue.js version

2.0.2

Reproduction Link

https://jsfiddle.net/uojhhjr7/
https://jsfiddle.net/k8bfrxwz/

While switching to Vue2, I realize that it's not possible to define a model initial value from the template anymore.

Let's say I have a server-side validated form (with a preview powered by Vue) which brings back the user if the validation detected an error.

I'd like to populate the form with the previously typed values (and get the corresponding preview), but I cannot simply set an inline value anymore because Vue warns me with
inline value attributes will be ignored when using v-model

I took a look at the migration guide and found a confirmation it was not possible anymore, but I can't find any workaround.

Of course, the simple solution would be to modify the initial value of the model within the Vue instantiation, but it's a children component from a vue file, webpacked with other scripts.

I got this solution working, but it seems a little bit overkill to me, regarding the usual elegance of Vue.js.

So here is the aim of this issue : Is there a way to pass an initial value to a v-model from template to Vue as we used to ?

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