0👍
Emit an event from sidebar
and handle the event in the main app.
main app:
<template>
<!-- ... -->
<sidebar :number="count" @reset="onReset" />
<!-- ... -->
</template>
<script>
export default {
// ...
methods: {
onReset() {
// api calls, etc.
this.count = 0;
}
}
}
</script>
sidebar:
<template>
<!-- ... -->
<button @click="$emit('reset')">Reset notification count</button>
<!-- ... -->
</template>
- [Vuejs]-How to make blur not replacing value on event with it previous value
- [Vuejs]-Getting readable date from ISO
Source:stackexchange.com