我想在 SAPUI5 中將一個數字保留到小數點後 2 位。誰能幫忙?


RoundingMode 函式用於舍入數字,它使用這些引數:數字和小數位數。

示例

您可以四捨五入,程式碼如下所示

<Input value="{
   path: 'helloPanel>/recipient/amount',
   type: 'sap.ui.model.type.Float',
   formatOptions: {
      maxFractionDigits: 2,
      roundingMode: 'away_from_zero'
   }
}"/>


更新於:2019 年 12 月 17 日

1 千次瀏覽

開啟你的 職業生涯

完成課程並獲得認證

開始學習
廣告
© . All rights reserved.