I'm using vue-cordova-webpack
(https://github.com/OnsenUI/vue-cordova-webpack) template project with Onsen UI
framework.
I have a child component that I call from parent like this:
<template>
<!-- ... -->
<child :value1="value1"
:value2="value2">
</child>
<!-- ... -->
</template>
in the child component I have:
<template>
<!-- ... -->
<v-ons-search-input v-model="mutableValue1"> </v-ons-search-input>
<v-ons-checkbox v-model="mutableValue2"> </v-ons-checkbox>
<!-- ... -->
</template>
export default {
props: ['value1', 'value2'],
name: 'child',
data() {
return {
mutableValue1: this.value1,
mutableValue2: this.value2,
};
}
};
now, as you can see, the mutableValue1
and mutableValue2
variables are updated when user changes values of <v-ons-search-input>
and <v-ons-checkbox>
components.
(I introduced those mutableValue1
and mutableValue2
variables in order to avoid [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders...
warning)
I need that values in parent view.
At the moment I don't have those values updated when accessing this.value1
and this.value2
in parent view.
How can I do that?
Thanks