zoukankan      html  css  js  c++  java
  • UI5-文档-4.18-Icons

    我们的对话框仍然是空的。因为SAPUI5附带了一个包含500多个图标的大图标字体,所以我们将在对话框打开时添加一个图标来问候用户。

    Preview

     

    An icon is now displayed in the dialog box

    Coding

    You can view and download all files at Walkthrough - Step 18.

    webapp/view/HelloPanel.view.xml

    <mvc:View
    
       controllerName="sap.ui.demo.walkthrough.controller.HelloPanel"
    
       xmlns="sap.m"
    
       xmlns:mvc="sap.ui.core.mvc">
    
       <Panel
    
          headerText="{i18n>helloPanelTitle}"
    
          class="sapUiResponsiveMargin"
    
          width="auto" >
    
          <content>
    
             <Button
    
                id="helloDialogButton"
    
                icon="sap-icon://world"
    
                text="{i18n>openDialogButtonText}"
    
                press="onOpenDialog"
    
                class="sapUiSmallMarginEnd"/>
    
             <Button
    
                text="{i18n>showHelloButtonText}"
    
                press="onShowHello"
    
                class="myCustomButton"/>
    
             <Input
    
                value="{/recipient/name}"
    
                valueLiveUpdate="true"
    
                width="60%"/>
    
               <FormattedText
    
                  htmlText="Hello {/recipient/name}"
    
                  class="sapUiSmallMargin sapThemeHighlight-asColor myCustomText"/>
    
          </content>
    
       </Panel>
    
    </mvc:View>

    我们向打开对话框的按钮添加一个图标 sap-icon://协议表示应该加载图标字体中的图标。标识符世界是图标字体中图标的可读名称。

    提示:您可以使用演示工具包中的图标资源管理器工具查找其他图标。

    若要调用任何图标,请使用sap-icon中的图标资源管理器中列出的图标名称://<iconname>。

    sap-icon://<iconname>.

    webapp/view/HelloDialog.fragment.xml

    <core:FragmentDefinition
    
       xmlns="sap.m"
    
       xmlns:core="sap.ui.core" >
    
       <Dialog
    
          id="helloDialog"
    
          title ="Hello {/recipient/name}">
    
          <content>
    
             <core:Icon
    
                src="sap-icon://hello-world"
    
                size="8rem"
    
                class="sapUiMediumMargin"/>
    
          </content>
    
          <beginButton>
    
             <Button
    
                text="{i18n>dialogCloseButtonText}"
    
                press="onCloseDialog"/>
    
          </beginButton>
    
       </Dialog>
    
    </core:FragmentDefinition>

     在对话框片段中,我们将图标控件添加到对话框的内容聚合中。幸运的是,图标字体还附带了一个“Hello World”图标,非常适合我们使用。我们还定义了图标的大小,并在其上设置了一个中等大小的空白。

    Conventions

      尽可能使用图标字体,而不是图像,因为它们是可伸缩的,没有质量损失(矢量图形),不需要单独加载。

    Parent topic: Walkthrough

    Previous: Step 17: Fragment Callbacks

    Next: Step 19: Reuse Dialogs

    Related Information

    Icon Explorer

    API Reference:sap.ui.core.Icon

    Samples:sap.ui.core.Icon

  • 相关阅读:
    使用node调用支付宝生成支付二维码(沙箱环境)
    nodejs+mysql嵌套查询的问题
    移动端H5开发问题记录
    在jquery中,使用ajax上传文件和文本
    css百分比值到底参考谁?
    vue cli3 + cube-ui 配置rem踩坑记录
    MFC【exe】工程中的文件大致信息(翻译的)
    ActiveX、OLE和COM/DCOM
    系统版本
    图形库
  • 原文地址:https://www.cnblogs.com/ricoo/p/10102856.html
Copyright © 2011-2022 走看看