platform.ts 650 B

123456789101112131415161718192021222324
  1. /*
  2. * @Author: 菲鸽
  3. * @Date: 2024-03-28 19:13:55
  4. * @Last Modified by: 菲鸽
  5. * @Last Modified time: 2024-03-28 19:24:55
  6. */
  7. export const platform = __UNI_PLATFORM__
  8. export const isH5 = __UNI_PLATFORM__ === 'h5'
  9. export const isApp = __UNI_PLATFORM__ === 'app'
  10. export const isMp = __UNI_PLATFORM__.startsWith('mp-')
  11. export const isMpWeixin = __UNI_PLATFORM__.startsWith('mp-weixin')
  12. export const isMpAplipay = __UNI_PLATFORM__.startsWith('mp-alipay')
  13. export const isMpToutiao = __UNI_PLATFORM__.startsWith('mp-toutiao')
  14. const PLATFORM = {
  15. platform,
  16. isH5,
  17. isApp,
  18. isMp,
  19. isMpWeixin,
  20. isMpAplipay,
  21. isMpToutiao,
  22. }
  23. export default PLATFORM