# Variable: mogs
• mogs(): MOGS
基础能力系统
mogs 的接口在微信上等价于 wx上的接口(详情参见 微信小游戏 API 文档 (opens new window)),在 QQ 上等价于 QQ(详情参见 QQ 小游戏 API 文档 (opens new window))
如下例子,微信上登陆接口调用 wx.login
,qq上登陆接口调用 qq.login
,使用mogs之后,只需要统一调用 mogs.login
,就能适配所有平台。
example
import mogs from '@timi/mogs-sdk'
mogs.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://test.com/onLogin',
data: {
code: res.code
}
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
注意⚠️:mogs上同时有异步和同步的接口,同步的接口在有乐
上不暂时不可用!
比如获取获取系统信息,微信和 QQ 同时支持 mogs.getSystemInfo
和 mogs.getSystemInfoSync
,但有乐上仅支持 mogs.getSystemInfo
# 返回值:
MOGS
← 概述 accountSystem →