Anleitung
Tutorial zu WeChat
Verwenden Sie @capgo/capacitor-wechat
Capacitor WeChat-Plugin - WeChat SDK-Integration für Authentifizierung, Teilen, Zahlungen und Mini-Programme
Installieren
bun add @capgo/capacitor-wechat
bunx cap sync
Was dieses Plugin enthüllt
initialize- Initialize the WeChat SDK with your application credentials.isInstalled- Überprüfen Sie, ob das WeChat-App auf dem Gerät installiert ist.auth- Authentifizieren Sie den Benutzer mit WeChat OAuth.share- Teilen Sie Inhalte auf WeChat.
Beispielanwendung
initialize
Initialisieren Sie den WeChat SDK mit Ihren Anwendungsanmeldeinformationen.
import { CapacitorWechat } from '@capgo/capacitor-wechat';
await CapacitorWechat.initialize({
appId: 'wx1234567890',
universalLink: 'https://example.com/app/'
});
isInstalled
Überprüfen Sie, ob die WeChat-App auf dem Gerät installiert ist.
import { CapacitorWechat } from '@capgo/capacitor-wechat';
const { installed } = await CapacitorWechat.isInstalled();
if (installed) {
console.log('WeChat is installed');
}
auth
Authentifizieren Sie den Benutzer mit WeChat OAuth.
import { CapacitorWechat } from '@capgo/capacitor-wechat';
const { code, state } = await CapacitorWechat.auth({
scope: 'snsapi_userinfo',
state: 'my_state'
});
// Use code to get access token from your server
share
Teilen Sie Inhalte auf WeChat.
import { CapacitorWechat } from '@capgo/capacitor-wechat';
// Share text
await CapacitorWechat.share({
scene: 0, // 0 = Session, 1 = Timeline, 2 = Favorite
type: 'text',
text: 'Hello WeChat!'
});
// Share link
await CapacitorWechat.share({
scene: 1,
type: 'link',
title: 'My Website',
description: 'Check out my website',
link: 'https://example.com',
imageUrl: 'https://example.com/image.jpg'
});
Vollständige Referenz
- GitHub: https://github.com/Cap-go/capacitor-wechat/
- Fahren Sie mit der Verwendung von @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-wechat fort.
Wenn Sie @capgo/capacitor-wechat verwenden
https://__CAPGO_KEEP_0__.com/Cap-go/__CAPGO_KEEP_1__-wechat/ Using @capgo/capacitor-wechat für die Planung der Authentifizierung und die Kontofluss-Flüsse, verbinden Sie es mit @capgo/capacitor-wechat für die Implementierungsdetails in @capgo/capacitor-wechat Einstieg für die Implementierungsdetails in Einstieg @capgo/capacitor-social-login für die Implementierungsdetails in @capgo/capacitor-social-login @capgo/capacitor-passkey für die Implementierungsdetails in @capgo/capacitor-passkey und @capgo/capacitor-native-biometric für die Implementierungsdetails in @capgo/capacitor-native-biometric.