Appearance
知晓云 sdk 挂载 - initBaaS
该方法可以理解为是增强版的 BaaS.init
,集成了 requirePlugin
动作,确保在执行 BaaS.init
之前已经将 BaaS
挂载到 uni
上,在项目中必须使用该方法进行 BaaS
初始化,以确保风格的一致性。
基本用法
initBaaS
使用方法与 BaaS.init
完全一致,需要在 App launch 时调用
js
import {onLaunch} from '@dcloudio/uni-app'
import {initBaaS} from '@ifanrx/uni-mp'
onLaunch(() => {
initBaaS('your_baas_client_id', {
autoLogin: true,
env: 'your_baas_env_id',
})
})
常见问题
需要根据环境区分配置
↩︎ 先看 《统一 vite 开发构建流程》
js
import {onLaunch} from '@dcloudio/uni-app'
import {initBaaS} from '@ifanrx/uni-mp'
import {BAAS_DEV, BAAS_QA} from '@/constants'
onLaunch(() => {
initBaaS(BAAS_QA ? 'your_qa_app_client_id' : 'your_production_client_id', {
autoLogin: true,
env: BAAS_DEV ? 'your_development_app_env_id' : undefined,
host: BAAS_QA ? 'https://v5204.eng.szx.ifanrx.com/' : undefined,
})
})
附:知晓云 QA 环境地址(需内网访问)
https://v5204.eng.szx.ifanrx.com/hydrogen
TIP
注意:账号密码找主管要。