{"id":1518,"date":"2023-03-25T14:11:39","date_gmt":"2023-03-25T06:11:39","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1518"},"modified":"2023-04-28T20:19:20","modified_gmt":"2023-04-28T12:19:20","slug":"wechat-mini-program-data-binding-reserve-decimal-places","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/wechat-mini-program-data-binding-reserve-decimal-places\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6570\u636e\u7ed1\u5b9a\u4fdd\u7559\u5c0f\u6570\u4f4d\u6570"},"content":{"rendered":"<p>\u4f7f\u7528wxs\u5199\u4e00\u4e2afilter\u8fc7\u6ee4\u51fd\u6570<\/p>\n<h2>WXS<\/h2>\n<p><!-- more --><\/p>\n<pre><code class=\"language-javascript\">\/*wxs*\/\nvar NumberFormat = {\n  toFix: function (value, precision) {\n    return value.toFixed(precision)\n  }\n}\n\nmodule.exports = {\n  toFix: NumberFormat.toFix\n}<\/code><\/pre>\n<h2>WXML<\/h2>\n<pre><code class=\"language-xml\">\/*wxml*\/\n&lt;wxs module=&quot;numberFormat&quot; src=&quot;..\/..\/filters\/NumberFormat.wxs&quot;&gt;&lt;\/wxs&gt;\n\n&lt;view&gt;{{numberFormat.toFix(item.price, 2)}}&lt;\/view&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528wxs\u5199\u4e00\u4e2afilter\u8fc7\u6ee4\u51fd\u6570 WXS \/*wxs*\/ var NumberFormat = { toF [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"class_list":["post-1518","post","type-post","status-publish","format-standard","hentry","category-wechat-mini-program"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1518"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1518\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}