标题取决于 SAPUI5 中的其他变量 [英] Title depending on other variable in SAPUI5

查看:28
本文介绍了标题取决于 SAPUI5 中的其他变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时当我想显示某些东西并隐藏其他东西时,我会这样做:visible={some_variable} 例如 .现在我必须处理 Dialog 标题我的意思是:我想根据其他变量做一些事情 - 如果 variabletitle="{i18n>a}" 并且如果 variable 是b 然后 title="{i18n>b}".我该怎么做?

Sometimes when I want to show something and hide other thing I just do: visible={some_variable} for example <Column visible={some_variable}>. Now I have to deal with Dialog title I mean: I would like to do something depending on other variable - if variable is a then title="{i18n>a}" and if variable is b then title="{i18n>b}". How can I do that?

推荐答案

三元运算符适用于 sapui5 绑定.所以在这种情况下,你可以这样做:

The ternary operator works in sapui5 bindings. So in this case, you could do:

<Dialog title="{= ${variable} === 'A' ? ${i18n>a} : ${i18n>b} }" />

如果它变得更复杂,格式化程序可能是更好的解决方案.

If it gets more complicated, a formatter might be a better solution.

这篇关于标题取决于 SAPUI5 中的其他变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆