When a component changes its state, it must notify about these updates.
You can subscribe to a parent component for the child's component data changes. Vue.js defines a special mechanism for it via the .sync modifier.
This means that every component that modifies its data must emit the update event in the following format.
this.$emit('update:prop', newProp);For example, this is how you update the component state when a pop-up window opens.
var _default = {
name: "wiz-popup",
methods: {
openPopup: function openPopup() {
if (!this.openedPopupValue) {
this.openedPopupValue = true;
this.$emit("open");
this.$emit("update:opened", this.openedPopupValue);
}
},
}
};