您可以创建设备模型并使用其属性来了解应用程序是否在手机上运行。请参阅以下链接:
https://help.sap.com/saphelp_uiaddon10/helpdata/en/32/5b8edafcfa4c9c8fbd42455a60e379/content.htm
编辑:
方法1:如果您的设备模型成立,那么你就可以在你的代码中使用它: 在Component.js:
var deviceModel = new sap.ui.model.json.JSONModel({
isTouch : sap.ui.Device.support.touch,
isNoTouch : !sap.ui.Device.support.touch,
isPhone : sap.ui.Device.system.phone,
isNoPhone : !sap.ui.Device.system.phone,
listMode : sap.ui.Device.system.phone ? "None" : "SingleSelectMaster",
listItemType : sap.ui.Device.system.phone ? "Active" : "Inactive"
});
deviceModel.setDefaultBindingMode("OneWay");
this.setModel(deviceModel, "device");
如果哟
sap.ui.Device.system.phone
值:
在XML:
<Dialog id="confirmDialog"
title="Confirm"
showHeader="true"
state="Warning"
stretch="{device>/isPhone}"
type="Standard">
方式二:您可以随时使用你不想创建一个单独的模型。但是,我建议您创建一个设备模型并使用它。
<Dialog id="confirmDialog"
title="Confirm"
showHeader="true"
state="Warning"
stretch="sap.ui.Device.system.phone"
type="Standard">