0
votes

I have a modal component with textarea which I use to edit data that's in my main instance. So the idea is when I open the modal component, the textarea should be showing current data value from the main instance, this can be done by passing data as prop to the modal component. But since it's prop, vue doesn't allow me to edit it in textarea. And if I use v-model for the textarea, how do I get the original data value the moment my modal popup?

Back in 1.x, I just need to add "two-way: true", but this approach depreciated in 2.0.

1
does it work if you pass an object containing the text property to the prop (instead of a plain text)?François Romain
I don't think you can do that, the textarea attribute is like this <textarea v-model="cellModel"></textarea> how do you put an object as v-model ?Arch1tect
I was meaning: pass myProp object as a prop and on the text area you pass v-model="myProp.cellModel". not sureFrançois Romain
You are absolutely genius, works like a charm!!!!!!!!!!!!Arch1tect
cool I make it as an answer so you can mark it as sloved : )François Romain

1 Answers

2
votes

pass myProp object as a prop and on the text area you pass v-model="myProp.cellModel"