跳到主要内容

货币过滤器

Money filters 根据 Shoplazza 管理后台中定义的货币格式对价格进行格式化。

money_with_symbol (money)

number | money_with_symbol
returns  string

格式化给定的价格。

提示

该 filter 的别名为 money

代码
{{ product.price | money }}
{{ product.price | money_with_symbol }}
数据
{
"product": {
"price": "12.88"
}
}
输出
$12.88
$12.88

money_without_currency

number | money_without_currency
returns  string

格式化给定的价格,不含货币符号。

代码
{{ product.price | money_without_currency }}
数据
{
"product": {
"price": "12.88"
}
}
输出
12.88