fix: 星云SDK支持纯web
This commit is contained in:
parent
3914dcc3f3
commit
ad0555da60
23
export.js
23
export.js
@ -5,31 +5,36 @@ import requestWeb from './web/request'
|
||||
import starCloudInstance from './star-cloud'
|
||||
|
||||
export const setStorage = (key, value) => {
|
||||
if (starCloudInstance.platform === 2) {
|
||||
setStorageWeb(key, value)
|
||||
} else {
|
||||
if (starCloudInstance.platform === 1) {
|
||||
setStorageUni(key, value)
|
||||
} else if (starCloudInstance.platform === 2) {
|
||||
setStorageWeb(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
export const getStorage = key => {
|
||||
if (starCloudInstance.platform === 2) {
|
||||
return getStorageWeb(key)
|
||||
if (starCloudInstance.platform === 1) {
|
||||
getStorageUni(key)
|
||||
}
|
||||
if (starCloudInstance.platform === 2) {
|
||||
getStorageWeb(key)
|
||||
}
|
||||
return getStorageUni(key)
|
||||
}
|
||||
|
||||
export const removeStorage = key => {
|
||||
if (starCloudInstance.platform === 1) {
|
||||
removeStorageUni(key)
|
||||
}
|
||||
if (starCloudInstance.platform === 2) {
|
||||
removeStorageWeb(key)
|
||||
} else {
|
||||
removeStorageUni(key)
|
||||
}
|
||||
}
|
||||
|
||||
export const request = async params => {
|
||||
if (starCloudInstance.platform === 1) {
|
||||
return await requestUni(params)
|
||||
}
|
||||
if (starCloudInstance.platform === 2) {
|
||||
return await requestWeb(params)
|
||||
}
|
||||
return await requestUni(params)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user