Home > Mobile >  Uni - app in development of conditional compilation
Uni - app in development of conditional compilation

Time:09-18

uni - how to implement the app across end compatible?

uni - app has commonly used components, JS API encapsulated as framework, developers according to uni - app specification development can guarantee the multi-platform compatibility, most of the business can be directly meet,
But each has its own features, so there are some not cross-platform,

In C, using # ifdef, # # ifndef way, for Windows, MAC and other different OS compiled code, uni - app reference in this line of thought, provides a means of conditional compilation, uni - app elegant in a project completed the platform to realize individuation,


writing: with # ifdef or # # ifndef % % PLATFORM beginning, end with # endif,
# ifdef: if defined only exist in a platform
# # ifndef: if not defined in addition to a platform there are
% % PLATFORM, PLATFORM name

# ifdef APP - PLUS conditional compilation code # endif said only appear in the App platform code

# # ifndef H5 for conditional compilation code # endif said that in addition to the H5 platform, other platforms are existing code

# ifdef H5 | | MP - WEIXIN conditional compilation code # endif said in the H5 platform or WeChat applet code (here only | |, impossible & amp; & Because there is no intersection)

% PLATFORM % values as follows: the APP - PLUS (APP), APP - PLUS - NVUE (APP NVUE), H5 (H5) PLATFORM, MP - WEIXIN (WeChat small application PLATFORM)




  • Related