H5是网页版,mp是小程序端,app-plus是app端
写法:以 #ifdef 或 #ifndef 加 %PLATFORM% 开头,以 #endif 结尾
#ifdef:if defined 仅在某平台存在
#ifndef:if not defined 除了某平台均存在
%PLATFORM%:平台名称
仅出现在 App 平台下的代码
// #ifdef APP-PLUS
需条件编译的代码
// #endif
除了 App 平台,其它平台均存在的代码
#ifndef APP-PLUS
需条件编译的代码
#endif
uni-app 中的 #ifdef MP是什么意思?条件编译
最新推荐文章于 2024-04-18 17:20:29 发布