El código es súper simple, por lo que no hablaré muchas tonterías aquí. Por favor lea los comentarios por ti mismo.
Proporcionar el código:
La copia del código es la siguiente:
<script>
// Compartir en WeChat
var wimg = "compartir la url de imagen 123";
var wurl = "compartir url 123";
var wDesc = 'Compartir contenido 123';
var wtit = 'compartir título 123';
var wappid = '';
function sharemsg () {// <span style = "Font-Family: Arial, Helvetica, Sans-serif;"> Enviar a amigos </span> <span style = "Font-Family: Arial, Helvetica, Sans-Serif;"> Título y contenido se muestran de manera predeterminada </span>
Weixinjsbridge.invoke ('sendappMessage', {
"Appid": wappid,
"img_url": Wimg,
"img_width": "200",
"img_height": "200",
"Enlace": Wurl,
"Desc": WDesc,
"Título": Wtit,
})
}
function sharequan () {// <span style = "Font-Family: Arial, Helvetica, Sans-serif;"> Share a Friends Circle solo la pantalla de título </span>
Weixinjsbridge.invoke ('shareTimeline', {
"img_url": Wimg,
"img_width": "200",
"img_height": "200",
"Enlace": Wurl,
"Desc": WDesc,
"Título": WTIT
});
}
function shareWeibo () {<span style = "Font-Family: Arial, Helvetica, Sans-Serif;"> // </span> <span style = "Font-Family: Arial, Helvetica, Sans-Serif;"> Share to Weibo solo contenido muestra </span>
Weixinjsbridge.invoke ('shareWeibo', {
"Contenido": WDESC,
"URL": Wurl,
});
}
// El evento weixinjsbridgeReady se activará cuando el navegador WeChat incorporado complete la inicialización interna.
document.addeventListener ('weixinjsbridgeReady', function onbridgeReady () {
// Enviarlo a amigos
Weixinjsbridge.on ('menú: share: appMessage', function (argv) {
SharemSg ();
});
// Compartir con amigos
Weixinjsbridge.on ('menú: share: timeline', function (argv) {
Sharequan ();
});
// Compartir en Weibo
Weixinjsbridge.on ('menú: share: weibo', function (argv) {
ShareWeibo ();
});
}, FALSO);
</script>
¿No es muy práctico? Úselo de acuerdo con sus necesidades.