设置个性化推荐开关

API兼容性:
QRN:v5.4.8
iOS:80011274 Android:60001480

引入


import { QCommonConfig } from 'qunar-react-native';

API

getPersonalConfig

获取当前个性化开关配置. 返回值为 true or false

QCommonConfig.getPersonalConfig((switch) => {
 // switch: true or false
})

setPersonalConfig

设置个性化开关 true or false

QCommonConfig.setPersonalConfig(true)

getConfigByKey(已废弃)

获取自定义开关 params格式为{"key":"xxx"},"xxx"为开关的key值,下同
返回值为'{"xxx":"${configValue}"}'

API兼容性:
QRN:v5.5.1 iOS:80011277 Android:60001493

QCommonConfig.getConfigByKey(params, configCallback = (res) => {alert(res.xxx)})

getConfig

获取某个key对应的开关配置, configValue从configCallback回调里获取

API兼容性:
iOS:80011285 Android:60001515

QCommonConfig.getConfig(key, configCallback = (res) => {alert(res)}, failCallback = () => {})