Reputation: 87
I want to execute setInterval in the child component from the parent component. When I do console.log
in start
it appears in the console, however the interval doesn't start. If I call the method in child component, then it works.
Child methods:
stop() {
clearInterval(this.t);
},
start() {
this.timer = setInterval(() => {this.call()}, 1000);
}
Parent method:
methods: {
update() {
this.$refs.childComponent.start();
},
}
Upvotes: 0
Views: 786