<Toolbar>
<ToolbarSpacer/>
<Button id="1" visible="false" />
<Button id="2" />
<SegmentedButton>
<Button id="3" />
<Button id="4" visible="false"/>
<Button id="5" />
</SegmentedButton>
<ToolbarSpacer/>
</Toolbar>
除按钮 1 之外的所有按钮均可见。如何隐藏按钮 4? 我尝试在 Controller 中 -
this.getView().byId("4").setVisible(false);
但按钮仍然可见。
sap.ui.版本 - 1.24.2
最佳答案
请清除您的浏览器缓存。在 Chrome 中输入“chrome://chrome/settings/clearBrowserData”作为网址。或在隐身选项卡中打开应用程序:使用 ctrl + shift + n 在 Chrome 中打开隐身选项卡。
这不是您的代码中的错误。
<Toolbar>
<ToolbarSpacer/>
<Button id="1" visible="false" />
<Button id="2" />
<SegmentedButton>
<Button id="3" />
<Button id="4" visible="false"/>
<Button id="5" />
</SegmentedButton>
<ToolbarSpacer/>
</Toolbar>
请参阅此示例,您的代码运行良好:example
编辑:至少在 sapui5 版本到 1.28.9 中存在错误
关于javascript - sapui5 - 如何从 SegmentedButton 隐藏一个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45672414/