我想根据两种不同条件的测试来设置能见度。它会充分地填满下面的测试。
我想测试的东西:
语法:
<Button visible="{= {${modelExample>name} !== '' && ${modelExample>name} !== null} && {${modelExample>nr} === 13 || ${modelExample>nr} === 14 } ? true: false}"问题:确实给出了一个错误。
问题:,什么是适合这个条件词的语法?有可能测试两种不同的东西吗?
发布于 2021-03-26 09:12:37
表达式绑定的可读性有点..。如果你的情况变得复杂,就去找一个格式化程序。(我更好的可读性)
JSONModel
this.getView().setModel(new JSONModel({
name: "",
nr: 10
}), "json");XML
<Button text="test" visible="{= ${json>/name} && (${json>/nr} === 13 || ${json>/nr} === 14) ? true : false}"/>formatter.js
myCond: function (sName, iNumber) {
if (sName && (iNumber === 13 || iNumber === 14)) {
return true;
} else {
return false;
}
}XML
<Button text="test" visible="{ parts: ['json>/name', 'json>/nr'], formatter: '.formatter.myCond'}"/>https://stackoverflow.com/questions/66799692
复制相似问题