Richtlinie
Tutorial zu WeChat
Mit @capgo/capacitor-wechat verwenden
Capacitor WeChat-Plugin - WeChat SDK-Integration für Authentifizierung, Teilen, Zahlungen und Mini-Programme.
Installieren
bun add @capgo/capacitor-wechat
bunx cap sync
Was diese Erweiterung offenlegt
initialize- Initialisiere das WeChat-Modul SDK mit deinen Anwendungsanmeldeinformationen.isInstalled- Überprüfe, ob das WeChat-App auf dem Gerät installiert ist.auth- Authentifiziere den Benutzer mit WeChat OAuth.share- Teile Inhalte auf WeChat.
Beispiel für die Verwendung
initialize
Initialisiere das WeChat-Modul SDK mit deinen Anwendungsanmeldeinformationen.
import { CapacitorWechat } from '@capgo/capacitor-wechat';
await CapacitorWechat.initialize({
appId: 'wx1234567890',
universalLink: 'https://example.com/app/'
});
isInstalled
Überprüfe, ob das 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
Authentifiziere 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
Teile 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/
- Dokumentation: /docs/plugins/wechat/
Weiter mit der Verwendung von @capgo/capacitor-wechat
Wenn Sie die Verwendung von Mit der Verwendung von @capgo/capacitor-wechat um die Authentifizierung und die Kontoflows zu planen, 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 zur Implementierungsdetail in @capgo/capacitor-social-login, @capgo/capacitor-passkey zur Implementierungsdetail in @capgo/capacitor-passkey, und @capgo/capacitor-native-biometric zur Implementierungsdetail in @capgo/capacitor-native-biometric.