Vue компонент модального окна. При вызове метода savePos
Vue.component('modal', {
template: '#modal-template',
props: ['show'],
methods: {
savePost: function () {
// Insert AJAX call here...
this.show = false;
}
}
});
new Vue({
el: '#app',
data: {
showModal: false
}
});
Выдает ошибку:
vue2.js:513 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "show"
(found in component <modal>)
Пробовал так:
var temp = this.show;
temp = false;
Тоже не работает. Не пойму, как использовать мутированные сойства.