[SOLVED] How to call component event manual?

hi, I would like to know how to call component event manual. for example , i want to call toggle component `s event named “toggle”, maybe my code like below words:

<f7-list-item>
	<span>教务部签批</span>
        <f7-toggle color="orange" id="m2" @change="checkTaggle" :checked="formContent.needManagerUser"  ></f7-toggle>
</f7-list-item>

let $$ = self.Dom7
$$('.m2').trigger("toggle");

But it does not work. I will wonder if u can show me the true code. thank u.

Hi guys, I really want to know how to solve this problem. Could some friend help?

You could try:

const app = self.$f7;

let myToggle = app.toggle.get(’#m2’);
myToggle.emit(‘toggle’);

Hi kozmanbalint, Thank u for ur reply. Did u test this mode? I test ur code in phone, it did not work . I even tested the follow code, the result is same.

let app = self.$f7
app.toggle.get('#m2').emit("toggle");

Looking at the toggle source, you should try:

const app = self.$f7;
const myToggle = app.toggle.get(’#m2’);
myToggle.toggle();

1 Like

Oh my god, it works. thank u Kozmanbalint. You really gave me a big favor.

You’re welcome.
Please add [SOLVED] prefix to the thread name.