更新记录
1.0.6(2025-07-15)
1.0.5(2025-07-08)
- 【修复】iOS存在的回调问题
- 【重要】统一安卓和苹果的回调函数
1.0.4(2025-07-04)
查看更多
平台兼容性
uni-app(4.66)
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
Android插件版本 |
iOS |
iOS插件版本 |
鸿蒙 |
- |
- |
- |
- |
- |
- |
5.0 |
1.0.4 |
12 |
1.0.4 |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(4.66)
Chrome |
Safari |
Android |
Android插件版本 |
iOS |
iOS插件版本 |
鸿蒙 |
微信小程序 |
- |
- |
5.0 |
1.0.2 |
12 |
1.0.4 |
- |
- |
Turbo UI 系列插件 - 支付宝极简版SDK
- 如您已购买
Turbo UI
,那么该插件可以免费使用源码版!
- 使用需要打自定义基座,最新支持4.71,4.66,4.63,4.72版本,其他自测
- 支持支付宝授权登录
配置文档
- 在根目录创建
AndroidManifest.xml
,放入以下代码
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="你的包名">
<application>
<meta-data android:name="com.alipay.app.id" android:value="你的应用Appid" />
<meta-data android:name="com.alipay.public.key" android:value="" />
<activity android:exported="true" android:name="com.alipay.sdk.app.AlipayResultActivity" tools:node="merge">
<intent-filter tools:node="replace">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- 用于跳回App -->
<data android:scheme="你的应用scheme" />
</intent-filter>
</activity>
</application>
</manifest>
uni-app x 示例代码
<script setup lang="uts">
import { tAlipayOpenAuthScheme,TAlipayApiOptions,TAlipayApiResult } from "@/uni_modules/t-alipay-api";
const login = () => {
new Promise((resolve,reject) => {
tAlipayOpenAuthScheme({
url: `https://authweb.alipay.com/auth?auth_type=PURE_OAUTH_SDK&app_id=你的APPID&scope=auth_user&state=init`,
scheme: "你的scheme", // ios必填
resolve,
reject
} as TAlipayApiOptions)
}).then((result: TAlipayApiResult) =>{
console.log(result)
}).catch((error: TAlipayApiResult)=>{
console.log(error)
})
}
</script>
uni-app vue3 示例代码
<script setup>
import { tAlipayOpenAuthScheme } from "@/uni_modules/t-alipay-api";
const login = () => {
new Promise((resolve,reject) => {
tAlipayOpenAuthScheme({
url: `https://authweb.alipay.com/auth?auth_type=PURE_OAUTH_SDK&app_id=你的APPID&scope=auth_user&state=init`,
scheme: "你的scheme", // ios必填
resolve,
reject
})
}).then((result) =>{
console.log(result)
}).catch((error)=>{
console.log(error)
})
}
</script>
uni-app vue2 示例代码
<script>
import { tAlipayOpenAuthScheme } from "@/uni_modules/t-alipay-api";
export default {
methods: {
login() {
new Promise((resolve,reject) => {
tAlipayOpenAuthScheme({
url: `https://authweb.alipay.com/auth?auth_type=PURE_OAUTH_SDK&app_id=你的APPID&scope=auth_user&state=init`,
scheme: "你的scheme", // ios必填
resolve,
reject
})
}).then((result) =>{
console.log(result)
}).catch((error)=>{
console.log(error)
})
}
}
}
</script>
暴露的类型
export type TAlipayData = {
authCode: string;
}
export type TAlipayApiResult = {
code: number;
msg: string;
data?: TAlipayData;
}
export type TAlipayApiOptions = {
url: string;
scheme: string;
resolve?: (result:TAlipayApiResult) => void;
reject?: (result:TAlipayApiResult) => void;
}
// #ifdef APP-IOS
export type TAlipayOpenAuthSchemeApi = (options: TAlipayApiOptions) => void;
// #endif