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'
|
import starCloudInstance from './star-cloud'
|
||||||
|
|
||||||
export const setStorage = (key, value) => {
|
export const setStorage = (key, value) => {
|
||||||
if (starCloudInstance.platform === 2) {
|
if (starCloudInstance.platform === 1) {
|
||||||
setStorageWeb(key, value)
|
|
||||||
} else {
|
|
||||||
setStorageUni(key, value)
|
setStorageUni(key, value)
|
||||||
|
} else if (starCloudInstance.platform === 2) {
|
||||||
|
setStorageWeb(key, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getStorage = key => {
|
export const getStorage = key => {
|
||||||
if (starCloudInstance.platform === 2) {
|
if (starCloudInstance.platform === 1) {
|
||||||
return getStorageWeb(key)
|
getStorageUni(key)
|
||||||
|
}
|
||||||
|
if (starCloudInstance.platform === 2) {
|
||||||
|
getStorageWeb(key)
|
||||||
}
|
}
|
||||||
return getStorageUni(key)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const removeStorage = key => {
|
export const removeStorage = key => {
|
||||||
|
if (starCloudInstance.platform === 1) {
|
||||||
|
removeStorageUni(key)
|
||||||
|
}
|
||||||
if (starCloudInstance.platform === 2) {
|
if (starCloudInstance.platform === 2) {
|
||||||
removeStorageWeb(key)
|
removeStorageWeb(key)
|
||||||
} else {
|
|
||||||
removeStorageUni(key)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const request = async params => {
|
export const request = async params => {
|
||||||
|
if (starCloudInstance.platform === 1) {
|
||||||
|
return await requestUni(params)
|
||||||
|
}
|
||||||
if (starCloudInstance.platform === 2) {
|
if (starCloudInstance.platform === 2) {
|
||||||
return await requestWeb(params)
|
return await requestWeb(params)
|
||||||
}
|
}
|
||||||
return await requestUni(params)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user