press-next
Version:
Vue3 组件库,支持 Composition API
37 lines (24 loc) • 532 B
text/typescript
// #ifdef MP-QQ
// @ts-ignore
import TIM_MP from 'tim-wx-sdk';
// #endif
// #ifdef MP-WEIXIN
import { getMpWxTIM } from './tim-mp-wx';
// #endif
// #ifdef H5
import { getWebTIM } from './tim-web';
// #endif
import type { TimType } from '../types';
export async function getTIM(): Promise<TimType> {
let result;
// #ifdef H5
result = await getWebTIM();
// #endif
// #ifdef MP-WEIXIN
result = await getMpWxTIM();
// #endif
// #ifdef MP-QQ
result = Promise.resolve(TIM_MP);
// #endif
return result;
}