VueJs: Touch after modifying selection value in child component
P粉878542459
P粉878542459 2023-09-04 17:10:56
0
1
436

I'm using VueJs and I have this child component in my parent component. When the selection of the child component changes, I need to trigger a function in the parent component.

Subcomponent:

watch: { selectCoin() { this.$emit("currencyType", this.selectCoin["title"]); } }

The child component I use inside the parent component:

When the child component responds to the $emit of the parent component, I need to call this method:

methods :{ myFunction() { } }
P粉878542459
P粉878542459

reply all (1)
P粉312631645

I successfully accomplished this by adding a function in the "v-on" of @currencyType and passing it the value received from the child component as a parameter.

methods :{ myFunction(ct) { } }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!