In VueJS is it possible to bind something with v-model that is then rebound to another child?

前端 未结 2 1039
感情败类
感情败类 2021-01-21 03:36

I have an app for which I\'m creating a custom component that will output a single row of a table. It contains a numeric field which is user-adjustable, and so within that c

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 04:15

    This is what I ended up with - seemed like the simplest approach. I was kind of hoping Vue would have a mechanism to hide this away when the 'middle' component effectively promises not to change the model, but just wants to hand it on to a child.

    Basically, I created an intermediary data element ivalue, and initialised it in the mounted() event, and use the input() event of the child to emit an input() event back to the parent.

    
    
    
    

提交回复
热议问题