// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif

- 发布:2025-04-11 09:49
- 更新:2025-04-11 11:26
- 阅读:124
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: macos 14.71
HBuilderX类型: 正式
HBuilderX版本号: 4.57
手机系统: iOS
手机系统版本号: iOS 15
手机厂商: 模拟器
手机机型: Iphone 15 pro
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif
// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif
预期结果:
// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif
// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif
实际结果:
// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif
// #ifdef APP-IOS
console.log("123344444");
const data = await getConfigMsg("APP_PAY_HIDE_VERSION");
console.log("data", data);
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(info.version);
if (data.value.includes(info.version)) {
this.showPay = false;
} else {
this.showPay = true;
this.radiovalue = "airwallex";
}
});
// #endif
bug描述:
使用ifdef APP-IOS不生效 , 不管是在模拟器还是打包成app都一样不生效 , 以前是没问题的
1 个回复
DCloud_UNI_yuhe
这个条件编译 #ifdef APP-IOS 在 uniapp 上只能在 uts 文件上使用,在 uniapp 上区分 android 和 ios 请使用 getSystemInfo
https://uniapp.dcloud.net.cn/tutorial/platform.html#uts