The parent component passes methods to the child component using $emit to trigger the parent component method to update data

Parent component <child V-on: same name published by the child component = "method to be passed to the child component to execute" > Child component this.$emit(" same event name as parent component ", data) Parent component:Copy the code

Child components:Copy the code