定义
方法名 | 定义 | 备注 |
---|---|---|
empty | (def = '') | 处理空值,det为默认值 |
number | (opt={fixed:-1,comma:false,plus:false}, def = '') | fixed为小数位,comma为千位符,plus为显示正负,det为默认值 |
date | (fmt='yyyy-MM-dd hh:mm:ss', def = '') | fmt为日期格式,det为默认值 |
empty
<div>'' -> '{{ '' | $paiui.empty('空') }}'</div>
<div>null -> '{{ null | $paiui.empty('空') }}'</div>
<div>undefined -> '{{ undefined | $paiui.empty('空') }}'</div>
number
<div>'' -> '{{ '' | $paiui.number({}, '空') }}'</div>
<div>12.56 -> '{{ 12.56 | $paiui.number() }}'</div>
<div>12.1256 -> '{{ 12.1256 | $paiui.number({ fixed: 2 }) }}'</div>
<div>1234567.1256 -> '{{ 1234567.1256 | $paiui.number({ fixed: 2, comma: true }) }}'</div>
<div>12.56 -> '{{ 12.56 | $paiui.number({ plus: true }) }}'</div>
<div>-12.56 -> '{{ -12.56 | $paiui.number({ plus: true }) }}'</div>
<div>1234.56 -> '{{ 1234.56 | $paiui.number.upperCase }}'</div>
<div>1234.3456 -> '{{ 1234.3456 | $paiui.number.decimal(2) }}'</div>
date
<div>'' -> '{{ '' | $paiui.date('', '空') }}'</div>
<div>new Date() -> '{{ new Date() | $paiui.date() }}'</div>
<div>1595992527161 -> '{{ 1595992527161 | $paiui.date() }}'</div>
<div>'2012-03-17' -> '{{ '2012-03-17' | $paiui.date() }}'</div>
<div>'2012/03/17' -> '{{ '2012/03/17' | $paiui.date() }}'</div>
<div>new Date() -> '{{ new Date() | $paiui.date('yyyy/MM/dd hh:mm') }}'</div>
<div>new Date() -> '{{ new Date() | $paiui.date('yyyy/MM/dd D') }}'</div>
<div>new Date() -> '{{ new Date() | $paiui.date('hh:mm:ss S') }}'</div>
<div>new Date('2019/07/01 01:02:03') -> '{{ new Date('2019/07/01 01:02:03') | $paiui.date('yy-M-d h:m:s') }}'</div>
文档更新时间: 2021-05-13 09:55 作者:管理员