platform.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const EPlatform = {
  2. AppPlus: 'APP-PLUS',
  3. /**App*/
  4. AppPlusNvue: 'APP-PLUS-NVUE',
  5. /**App nvue*/
  6. H5: 'H5',
  7. /**H5*/
  8. MpAlipay: 'MP-ALIPAY',
  9. /**支付宝小程序*/
  10. MpWeixin: 'MP-WEIXIN',
  11. /**微信小程序*/
  12. MpBaidu: 'MP-BAIDU',
  13. /**百度小程序*/
  14. MpToutiao: 'MP-TOUTIAO',
  15. /**字节跳动小程序*/
  16. MpQq: 'MP-QQ',
  17. /**QQ小程序*/
  18. Mp360: 'MP-360',
  19. /**360小程序*/
  20. QuickappWebview: 'quickapp-webview',
  21. /**快应用通用(包含联盟、华为)*/
  22. QuickappWebviewUnion: 'quickapp-webview-union',
  23. /**快应用联盟*/
  24. QuickappWebviewHuawei: 'quickapp-webview-huawei' /**快应用华为*/
  25. }
  26. export default function ifDefPlatform() {
  27. let platform = ''
  28. //#ifdef
  29. platform = '';
  30. //#endif
  31. //#ifdef APP-PLUS
  32. platform = EPlatform.AppPlus;
  33. //#endif
  34. //#ifdef -NVUE
  35. platform = EPlatform.AppPlusNvue;
  36. //#endif
  37. //#ifdef H5
  38. platform = EPlatform.H5;
  39. //#endif
  40. //#ifdef MP-WEIXIN
  41. platform = EPlatform.MpWeixin;
  42. //#endif
  43. //#ifdef MP-ALIPAY
  44. platform = EPlatform.MpAlipay;
  45. //#endif
  46. //#ifdef MP-BAIDU
  47. platform = EPlatform.MpBaidu;
  48. //#endif
  49. //#ifdef MP-TOUTIAO
  50. platform = EPlatform.MpToutiao;
  51. //#endif
  52. //#ifdef MP-QQ
  53. platform = EPlatform.MpQq;
  54. //#endif
  55. //#ifdef MP-360
  56. platform = EPlatform.Mp360;
  57. //#endif
  58. //#ifdef quickapp-webview
  59. platform = EPlatform.QuickappWebview;
  60. //#endif
  61. //#ifdef quickapp-webview-union
  62. platform = EPlatform.QuickappWebviewUnion;
  63. //#endif
  64. //#ifdef quickapp-webview-huawei
  65. platform = EPlatform.QuickappWebviewHuawei;
  66. //#endif
  67. return platform
  68. }