Skip to content

Commit

Permalink
fix(alipay): 支付宝小程序 api 不支持提示逻辑错误
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Nov 8, 2018
1 parent 721ebf4 commit 84b05ae
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/taro-alipay/src/native-api.js
Expand Up @@ -226,19 +226,17 @@ function request (options) {
function processApis (taro) { function processApis (taro) {
const weApis = Object.assign({ }, onAndSyncApis, noPromiseApis, otherApis) const weApis = Object.assign({ }, onAndSyncApis, noPromiseApis, otherApis)
Object.keys(weApis).forEach(key => { Object.keys(weApis).forEach(key => {
if (!(key in my)) {
taro[key] = () => {
console.warn(`支付宝小程序暂不支持 ${key}`)
}
return
}
if (!onAndSyncApis[key] && !noPromiseApis[key]) { if (!onAndSyncApis[key] && !noPromiseApis[key]) {
taro[key] = (options, ...args) => { taro[key] = (options, ...args) => {
const result = generateSpecialApis(key, options || {}) const result = generateSpecialApis(key, options || {})
const newKey = result.api const newKey = result.api
options = result.options options = result.options
let task = null let task = null
let obj = Object.assign({}, options) let obj = Object.assign({}, options)
if (!(newKey in my)) {
console.warn(`支付宝小程序暂不支持 ${newKey}`)
return
}
if (typeof options === 'string') { if (typeof options === 'string') {
if (args.length) { if (args.length) {
return my[newKey](options, ...args) return my[newKey](options, ...args)
Expand Down Expand Up @@ -290,6 +288,10 @@ function processApis (taro) {
} }
} else { } else {
taro[key] = (...args) => { taro[key] = (...args) => {
if (!(key in my)) {
console.warn(`支付宝小程序暂不支持 ${key}`)
return
}
if (key === 'getStorageSync') { if (key === 'getStorageSync') {
const arg1 = args[0] const arg1 = args[0]
if (arg1 != null) { if (arg1 != null) {
Expand Down

0 comments on commit 84b05ae

Please sign in to comment.