Sapui5 UI5 MessageBox保持透明
我有一个消息框,我想在一行上做一些额外的编辑。但一旦我展示了它,它仍然是透明的。是不是有什么东西我没有给它一个正常的背景Sapui5 UI5 MessageBox保持透明,sapui5,Sapui5,我有一个消息框,我想在一行上做一些额外的编辑。但一旦我展示了它,它仍然是透明的。是不是有什么东西我没有给它一个正常的背景 <Label text="UnitPrice"/> <Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/> <Label text="Quantity"/> <Input type="Text" tex
<Label text="UnitPrice"/>
<Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
<Label text="Quantity"/>
<Input type="Text" text="{path: 'Quantity' }"/>
</form:SimpleForm>
</core:FragmentDefinition>
表单的片段:
<Label text="UnitPrice"/>
<Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
<Label text="Quantity"/>
<Input type="Text" text="{path: 'Quantity' }"/>
</form:SimpleForm>
</core:FragmentDefinition>
我将样式类:“sapUiSizeCompact”更改为soemthing else,然后为该样式添加背景色。
然后盒子就不再是透明的了 我不认为sap.m.MessageBox是为输入而设计的,而不是基于简单按钮的选择。当然,这就是我阅读的方式(这也是消息框在其他API中通常的工作方式):
<Label text="UnitPrice"/>
<Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
<Label text="Quantity"/>
<Input type="Text" text="{path: 'Quantity' }"/>
</form:SimpleForm>
</core:FragmentDefinition>
提供更简单的方法来创建类型为sap.m.DialogType.Message的sap.m.Dialog,例如标准警报、确认对话框或任意消息对话框
<Label text="UnitPrice"/>
<Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
<Label text="Quantity"/>
<Input type="Text" text="{path: 'Quantity' }"/>
</form:SimpleForm>
</core:FragmentDefinition>
你可以强迫它允许你添加一个输入字段,但我不认为它是这样设计的(在我看来它没有文档),如果它在未来的版本中被破坏,也不要感到惊讶。而是使用sap.m.Dialog 这里也有同样的问题
<Label text="UnitPrice"/>
<Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
<Label text="Quantity"/>
<Input type="Text" text="{path: 'Quantity' }"/>
</form:SimpleForm>
</core:FragmentDefinition>
解决方案:我在基于sap.ui.common元素的项目中使用了sap.m.MessageBox。将其替换为sap.ui.common.MessageBox,我有一个运行良好的消息框。方法show需要一个消息字符串,你传递一个片段?!它确实支持布局sap.m.MessageBox.show(vMessage,mOptions?),唯一必需的参数是vMessage。可以提供带有相应文本的字符串,甚至可以提供布局控件。没错,它也接受控件,但我不确定它是否打算将完整的布局传递给消息框。我认为它更适合于简单的控件,例如文本。在复杂的情况下,我更喜欢使用专用对话框。
<Label text="UnitPrice"/>
<Input id='unitpriceid' type="Text" text="{path: 'UnitPrice' }"/>
<Label text="Quantity"/>
<Input type="Text" text="{path: 'Quantity' }"/>
</form:SimpleForm>
</core:FragmentDefinition>