conditional-compilation.mdc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ---
  2. description: Uni-App X conditional compilation
  3. globs: *.uts,*.uvue,*.css,*.less,*.scss,*.ts,*.js,*.sass,*.json
  4. alwaysApply: false
  5. ---
  6. # conditional compilation
  7. ## core syntax
  8. ```
  9. // Platform basic judgment
  10. #ifdef APP || MP
  11. //Mini programs/APP common code
  12. #ifdef APP-ANDROID
  13. // Android-specific logic
  14. #endif
  15. #ifdef APP-IOS
  16. // IOS-specific logic
  17. #endif
  18. #endif
  19. ```
  20. ## Core Platform Identifier
  21. uniVersion is used to distinguish the version of the compiler Details HBuilderX 3.9.0
  22. APP App
  23. APP-ANDROID App Android Platform Details
  24. APP-IOS App iOS Platform Details
  25. APP-HARMONY App HarmonyOS Next platform
  26. WEB web (same as H5) HBuilderX 3.6.3
  27. MP-WEIXIN WeChat Mini Program
  28. MP-ALIPAY APPLET
  29. MP-BAIDU BAIDU MINI PROGRAM
  30. MP-TUTIAO TIKTOK MINI PROGRAM
  31. MP-KUAISHOU Kuaishou Mini Program
  32. MP-JD JD Mini Program
  33. MP-HARMONY Harmony Atom Service HBuilderX 4.34
  34. MP-XHS Xiaohongshu Mini Program
  35. MP WeChat Mini Program/Alipay Mini Program/Baidu Mini Program/Douyin Mini Program/Feishu Mini Program/QQ Mini Program/360 Mini Program/Hongmeng atom Service