contenido
Primero introduzca jQuery en vue, vea: https://blog.csdn.net/qq_40323256/article/details/123904400?spm=1001.2014.3001.5501
ejecutar función nombrada
Sin parámetros:
Cuando no hay parámetros, el nombre de la función se puede pasar directamente, es decir, this.$(nombre de la función)
function test() {
alert("hello");
}
this.$(test);
Por supuesto, también puede agregar (), es decir, this.$(test());
Contiene parámetros:
function test(a) {
alert("hello:" + a);
}
this.$(test("李疆"));
ejecutar función anónima
Sin parámetros:
Cuando no hay parámetros, puede ejecutar la función sin agregar (), de la siguiente manera:
this.$(() => {
alert("hello");
});
Contiene parámetros:
Cuando incluya parámetros, use: this.$((()=>{})(parámetros))
this.$(
((a) => {
alert("hello" + a);
})(1234)
);