amis/gh-pages/docs/concepts/data-mapping_7b3f134.js
2020-07-31 11:19:51 +08:00

266 lines
97 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

amis.define('docs/concepts/data-mapping.md', function(require, exports, module, define) {
module.exports = {
"title": "数据映射",
"description": null,
"type": 0,
"group": "💡 概念",
"menuName": "数据映射",
"icon": null,
"order": 12,
"html": "<p>数据映射支持用户通过<code>${xxx}</code>或<code>$xxx</code>获取当前数据链中某个变量的值,实现灵活的数据配置功能,主要用于模板字符串、 自定义 <code>api</code> 请求数据体格式等场景。</p>\n<h2><a class=\"anchor\" name=\"%E6%A8%A1%E6%9D%BF%E5%AD%97%E7%AC%A6%E4%B8%B2\" href=\"#%E6%A8%A1%E6%9D%BF%E5%AD%97%E7%AC%A6%E4%B8%B2\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>模板字符串</h2><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"name\": \"rick\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"my name is ${name}\" // 输出: my name is rick\n }\n}\n</script></div>\n<p><strong>tip</strong> 默认 amis 在解析模板字符串时,遇到<code>$</code>字符会尝试去解析该变量并替换改模板变量,如果你想输出纯文本<code>&quot;${xxx}&quot;</code>或<code>&quot;$xxx&quot;</code>,那么需要在<code>$</code>前加转义字符<code>&quot;\\\\&quot;</code>,即<code>&quot;\\\\${xxx}&quot;</code></p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"name\": \"rick\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"my name is \\\\${name}\"\n }\n}\n</script></div>\n<h2><a class=\"anchor\" name=\"%E6%94%AF%E6%8C%81%E9%93%BE%E5%BC%8F%E5%8F%96%E5%80%BC\" href=\"#%E6%94%AF%E6%8C%81%E9%93%BE%E5%BC%8F%E5%8F%96%E5%80%BC\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>支持链式取值</h2><p>可以使用<code>.</code>进行链式取值</p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"name\": \"rick\",\n \"company\": {\n \"name\": \"baidu\",\n \"department\": \"it\"\n }\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"my name is ${name}, I work for ${company.name}\" // 输出 my name is rick, I work for baidu\n }\n}\n</script></div>\n<h2><a class=\"anchor\" name=\"%E8%87%AA%E5%AE%9A%E4%B9%89-api-%E8%AF%B7%E6%B1%82%E4%BD%93%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F\" href=\"#%E8%87%AA%E5%AE%9A%E4%B9%89-api-%E8%AF%B7%E6%B1%82%E4%BD%93%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>自定义 api 请求体数据格式</h2><p>在表单提交接口时amis 默认的请求体数据格式可能不符合你的预期,不用担心,你可以使用数据映射定制想要的数据格式:</p>\n<p>查看下面这种场景:</p>\n<div class=\"amis-preview\" style=\"height: 550px\"><script type=\"text/schema\" height=\"550\" scope=\"body\">{\n \"type\": \"form\",\n \"api\": \"https://houtai.baidu.com/api/mock2/form/saveForm\",\n \"controls\": [\n {\n \"type\": \"text\",\n \"name\": \"name\",\n \"label\": \"姓名:\"\n },\n {\n \"name\": \"email\",\n \"type\": \"text\",\n \"label\": \"邮箱:\"\n }\n ]\n}\n</script></div>\n<p>当输入姓名:<code>rick</code> 和邮箱:<a href=\"mailto:`rick@gmail.com\">`rick@gmail.com</a><code>后,</code>form` 获取当前的数据域,提交后端接口的数据格式应该是这样的:</p>\n<pre><code class=\"lang-json\"><span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"email\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick@gmail.com\"</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<p>遗憾的是,你的后端接口只支持的如下的输入数据结构,且无法修改:</p>\n<pre><code class=\"lang-json\"><span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"userName\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"xxx\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"userEmail\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"xxx@xxx.com\"</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<p>这时,除了直接更改你的 姓名表单项 和 邮箱表单项 的<code>name</code>属性为相应的字段以外,你可以配置<code>api</code>的<code>data</code>属性,使用<strong>数据映射</strong>轻松实现<strong>数据格式的自定义:</strong></p>\n<div class=\"amis-preview\" style=\"height: 550px\"><script type=\"text/schema\" height=\"550\" scope=\"body\">{\n \"type\": \"form\",\n \"api\": {\n \"method\": \"post\",\n \"url\": \"https://houtai.baidu.com/api/mock2/form/saveForm\",\n \"data\": {\n \"userName\": \"${name}\",\n \"userEmail\": \"${email}\"\n }\n },\n \"controls\": [\n {\n \"type\": \"text\",\n \"name\": \"name\",\n \"label\": \"姓名:\"\n },\n {\n \"name\": \"email\",\n \"type\": \"text\",\n \"label\": \"邮箱:\"\n }\n ]\n}\n</script></div>\n<p>你可以查看网络面板,发送给后端接口的数据体应该已经成功修改为:</p>\n<pre><code class=\"lang-json\"><span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"userName\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"userEmail\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick@gmail.com\"</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<h2><a class=\"anchor\" name=\"%E5%A4%8D%E6%9D%82%E9%85%8D%E7%BD%AE\" href=\"#%E5%A4%8D%E6%9D%82%E9%85%8D%E7%BD%AE\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>复杂配置</h2><h3><a class=\"anchor\" name=\"%E5%B1%95%E5%BC%80%E6%89%80%E9%85%8D%E7%BD%AE%E7%9A%84%E6%95%B0%E6%8D%AE\" href=\"#%E5%B1%95%E5%BC%80%E6%89%80%E9%85%8D%E7%BD%AE%E7%9A%84%E6%95%B0%E6%8D%AE\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>展开所配置的数据</h3><p>可以使用<code>&quot;&amp;&quot;</code>,作为数据映射 key展开所配置的变量例如</p>\n<p>下面例子中,我们想在提交的时候,除了提交 <code>name</code> 和 <code>email</code> 变量以外,还想添加 <code>c</code> 下面的所有变量 <code>e</code>,<code>f</code>,<code>g</code>,但是按照之前所讲的, api 应该这么配置:</p>\n<div class=\"amis-preview\" style=\"height: 550px\"><script type=\"text/schema\" height=\"550\" scope=\"body\">{\n \"type\": \"form\",\n \"data\": {\n \"a\": \"1\",\n \"b\": \"2\",\n \"c\": {\n \"e\": \"3\",\n \"f\": \"4\",\n \"g\": \"5\"\n }\n },\n \"api\": {\n \"url\": \"https://houtai.baidu.com/api/mock2/form/saveForm\",\n \"method\": \"post\",\n \"data\": {\n \"name\": \"${name}\",\n \"email\": \"${email}\",\n \"e\": \"${c.e}\",\n \"f\": \"${c.f}\",\n \"g\": \"${c.g}\"\n }\n },\n \"controls\": [\n {\n \"type\": \"text\",\n \"name\": \"name\",\n \"label\": \"姓名:\"\n },\n {\n \"name\": \"email\",\n \"type\": \"text\",\n \"label\": \"邮箱:\"\n }\n ]\n}\n</script></div>\n<p>点击提交查看网络面板数据,你会发现数据是符合预期的:</p>\n<pre><code class=\"lang-json\"><span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"email\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick@gmail.comn\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"e\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"3\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"f\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"4\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"g\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"5\"</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<p>但是当变量字段过多的时候,你需要一一映射配置,也许有点麻烦,所以可以使用<code>&quot;&amp;&quot;</code>标识符,来展开所配置变量:</p>\n<div class=\"amis-preview\" style=\"height: 550px\"><script type=\"text/schema\" height=\"550\" scope=\"body\">{\n \"type\": \"form\",\n \"data\": {\n \"a\": \"1\",\n \"b\": \"2\",\n \"c\": {\n \"e\": \"3\",\n \"f\": \"4\",\n \"g\": \"5\"\n }\n },\n \"api\": {\n \"url\": \"https://houtai.baidu.com/api/mock2/form/saveForm\",\n \"method\": \"post\",\n \"data\": {\n \"name\": \"${name}\",\n \"email\": \"${email}\",\n \"&\": \"${c}\"\n }\n },\n \"controls\": [\n {\n \"type\": \"text\",\n \"name\": \"name\",\n \"label\": \"姓名:\"\n },\n {\n \"name\": \"email\",\n \"type\": \"text\",\n \"label\": \"邮箱:\"\n }\n ]\n}\n</script></div>\n<p>上例中我们 api.data 配置如下:</p>\n<pre><code class=\"lang-json\"><span class=\"token property\">\"data\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"${name}\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"email\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"${email}\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"&amp;\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"${c}\"</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<p><code>&quot;&amp;&quot;</code>标识符会将所配置的<code>c</code>变量的<code>value</code>值,展开并拼接在<code>data</code>中。查看网络面板可以看到数据如下:</p>\n<pre><code class=\"lang-json\"><span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"email\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"rick@gmail.comn\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"e\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"3\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"f\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"4\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"g\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"5\"</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<h3><a class=\"anchor\" name=\"%E6%95%B0%E7%BB%84%E6%8F%90%E5%8F%96%E5%80%BC\" href=\"#%E6%95%B0%E7%BB%84%E6%8F%90%E5%8F%96%E5%80%BC\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>数组提取值</h3><div class=\"amis-preview\" style=\"height: 550px\"><script type=\"text/schema\" height=\"550\" scope=\"body\">{\n \"type\": \"form\",\n \"api\": {\n \"method\": \"post\",\n \"url\": \"https://houtai.baidu.com/api/mock2/form/saveForm\",\n \"data\": {\n \"items\": {\n \"$table\": {\n \"a\": \"${a}\",\n \"c\": \"${c}\"\n }\n }\n }\n },\n \"controls\": [\n {\n \"type\": \"table\",\n \"name\": \"table\",\n \"label\": \"table\",\n \"columns\": [\n {\n \"label\": \"A\",\n \"name\": \"a\"\n },\n {\n \"label\": \"B\",\n \"name\": \"b\"\n },\n {\n \"label\": \"C\",\n \"name\": \"c\"\n }\n ],\n \"value\": [\n {\n \"a\": \"a1\",\n \"b\": \"b1\",\n \"c\": \"c1\"\n },\n {\n \"a\": \"a2\",\n \"b\": \"b2\",\n \"c\": \"c2\"\n },\n {\n \"a\": \"a3\",\n \"b\": \"b3\",\n \"c\": \"c3\"\n }\n ]\n }\n ]\n}\n</script></div>\n<p>上例中的<code>api</code>的<code>data</code>配置格式如下:</p>\n<pre><code class=\"lang-json\"><span class=\"token property\">\"data\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"items\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"$table\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"a\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"${a}\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"c\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"${c}\"</span>\n <span class=\"token punctuation\">}</span>\n <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<p>这个配置的意思是,只提取<code>table</code>数组中的<code>a</code>变量和<code>c</code>变量,组成新的数组,赋值给<code>items</code>变量</p>\n<p>点击提交,查看浏览器网络面板可以发现,表单的提交数据结构如下:</p>\n<pre><code class=\"lang-json\"><span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"items\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"a\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"a1\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"c\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"c1\"</span>\n <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"a\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"a2\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"c\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"c2\"</span>\n <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n <span class=\"token punctuation\">{</span>\n <span class=\"token property\">\"a\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"a3\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token property\">\"c\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"c3\"</span>\n <span class=\"token punctuation\">}</span>\n <span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<h2><a class=\"anchor\" name=\"%E8%BF%87%E6%BB%A4%E5%99%A8\" href=\"#%E8%BF%87%E6%BB%A4%E5%99%A8\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>过滤器</h2><p>过滤器是对数据映射的一种增强,它的作用是对获取数据做一些处理,基本用法如下:</p>\n<pre><code>${xxx [ |filter1 |filter2...] }\n</code></pre><p>下面我们会逐一介绍每一个过滤器的用法。</p>\n<blockquote>\n<p>过滤器可以 <a href=\"#%E4%B8%B2%E8%81%94%E4%BD%BF%E7%94%A8%E8%BF%87%E6%BB%A4%E5%99%A8\">串联使用</a></p>\n</blockquote>\n<h3><a class=\"anchor\" name=\"html\" href=\"#html\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>html</h3><p>用于显示 html 文本。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | html}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"html\": \"<div>这是一段<code>html</code></div>\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"html is: ${html|html}\"\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"raw\" href=\"#raw\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>raw</h3><p>不同场景下在使用数据映射时amis 可能默认会使用<code>html</code>过滤器对数据进行转义显示,这时如果想要输出原始文本,请配置<code>raw</code>过滤器。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><p>使用<code>raw</code>可以直接输出原始文本</p>\n<pre><code>${xxx | raw}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"html\": \"<div>这是一段<code>html</code></div>\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"html is: ${html|raw}\"\n }\n}\n</script></div>\n<blockquote>\n<p><strong>注意!!!</strong></p>\n<p><code>raw</code>过滤器虽然支持显示原始文本,也就意味着可以输出 HTML 片段,但是动态渲染 HTML 是非常危险的,容易导致 <strong>XSS</strong> 攻击。</p>\n<p>因此在 使用<code>raw</code>过滤器的时候,请确保变量的内容可信,且永远不要渲染用户填写的内容。</p>\n</blockquote>\n<h3><a class=\"anchor\" name=\"json\" href=\"#json\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>json</h3><p>用于将数据转换为<code>json</code>格式字符串</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | json[:tabSize]}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"info\": {\n \"name\": \"rick\",\n \"company\": \"baidu\"\n }\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"my info is ${info|json}\" // 输出: my info is { \"name\": \"rick\", \"company\": \"baidu\" }\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E6%8C%87%E5%AE%9A%E7%BC%A9%E8%BF%9B%E6%95%B0\" href=\"#%E6%8C%87%E5%AE%9A%E7%BC%A9%E8%BF%9B%E6%95%B0\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>指定缩进数</h5><pre><code>${xxx|json:4} // 指定缩进为4个空格\n</code></pre><h3><a class=\"anchor\" name=\"tojson\" href=\"#tojson\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>toJson</h3><p>与<a href=\"#json\">json</a>相反,用于将<code>json</code>格式的字符串,转换为<code>javascript</code>对象</p>\n<pre><code>${xxx | toJson}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"info\": \"{\\\"name\\\": \\\"rick\\\", \\\"company\\\": \\\"baidu\\\"}\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"my info is ${info|toJson}\"\n }\n}\n</script></div>\n<p>对<code>Javascript</code>的直接输出会显示<code>[object Object]</code>,你可以使用 <a href=\"./data-mapping#json\">json 过滤器</a> 来格式化显示<code>json</code>文本。</p>\n<h3><a class=\"anchor\" name=\"date\" href=\"#date\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>date</h3><p>日期格式化过滤器,用于把特定时间值按指定格式输出。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | date[:format][:inputFormat]}\n</code></pre><ul>\n<li><strong>format</strong>:需要展示的格式,默认为<code>&#39;LLL&#39;</code>,即本地化时间格式</li>\n<li><strong>inputFormat</strong>:指定该变量值的格式,默认为<code>&#39;X&#39;</code>,即时间戳</li>\n</ul>\n<p>具体参数的配置需要参考 <a href=\"https://momentjs.com/docs/\">moment</a></p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"now\": 1586865590\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"now is ${now|date}\" // 输出: now is 2020年4月14日晚上7点59分\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E9%85%8D%E7%BD%AE%E8%BE%93%E5%87%BA%E6%A0%BC%E5%BC%8F\" href=\"#%E9%85%8D%E7%BD%AE%E8%BE%93%E5%87%BA%E6%A0%BC%E5%BC%8F\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>配置输出格式</h5><p>例如你想将某一个时间值,以 <code>2020-04-14</code> 这样的格式输出,那么查找 moment 文档可知配置格式应为 <code>YYYY-MM-DD</code>,即:</p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"now\": 1586865590\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"now is ${now|date:YYYY-MM-DD}\" // 通过配置输出格式,输出: now is 2020-04-14\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F\" href=\"#%E9%85%8D%E7%BD%AE%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>配置数据格式</h5><p>如果你的数据值默认不是<code>X</code>格式(即时间戳格式),那么需要配置<code>inputformat</code>参数用于解析当前时间值,例如:</p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"now\": \"2020/4/14 19:59:50\" // 查阅 moment 文档可知,需要配置数据格式为 \"YYYY/MM/DD HH:mm:ss\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"now is ${now|date:LLL:YYYY/MM/DD HH\\\\:mm\\\\:ss}\" // 配置输出格式和数据格式,输出: now is 2020年4月14日晚上7点59分\n }\n}\n</script></div>\n<blockquote>\n<p><strong>注意:</strong> 在过滤器参数中使用<code>:</code>字符,需要在前面加<code>\\\\</code>转义字符</p>\n</blockquote>\n<h3><a class=\"anchor\" name=\"number\" href=\"#number\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>number</h3><p>自动给数字加千分位。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | number}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"price\": 233333333\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"price is ${price|number}\" // 输出: price is 233,333,333\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"trim\" href=\"#trim\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>trim</h3><p>把变量值前后多余的空格去掉。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | trim}\n</code></pre><h3><a class=\"anchor\" name=\"percent\" href=\"#percent\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>percent</h3><h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | percent[:decimals]}\n</code></pre><ul>\n<li><strong>decimals</strong>:指定小数点后<code>n</code>位数,默认为<code>0</code></li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value\": 0.8232343\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"value is ${value|percent}\" // 输出: value is 82%\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E6%8C%87%E5%AE%9A%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E4%BD%8D%E6%95%B0\" href=\"#%E6%8C%87%E5%AE%9A%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E4%BD%8D%E6%95%B0\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>指定小数点后位数</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value\": 0.8232343\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"value is ${value|percent:2}\" // 保留小数点后4位输出: value is 82.32%\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"round\" href=\"#round\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>round</h3><p>四舍五入取整</p>\n<pre><code>${xxx | round[:decimals]}\n</code></pre><ul>\n<li><strong>decimals</strong>:指定小数点后<code>n</code>位小数,默认为<code>2</code></li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"number1\": 2.3,\n \"number2\": 2.6\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"number1 is ${number1|round}, number2 is ${number2|round}\" // 输出: number1 is 2.30, number2 is 2.60\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E6%8C%87%E5%AE%9A%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E4%BD%8D%E6%95%B0\" href=\"#%E6%8C%87%E5%AE%9A%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E4%BD%8D%E6%95%B0\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>指定小数点后位数</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"number\": 2.6\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"number is ${number|round:0}\" // 保留小数点后0位输出: number is 3\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"truncate\" href=\"#truncate\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>truncate</h3><p>当超出若干个字符时,后面的部分直接显示某串字符</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | truncate[:length][:mask]}\n</code></pre><ul>\n<li><strong>length</strong>:指定多长的字符后省略,默认为<code>200</code></li>\n<li><strong>mask</strong>:省略时显示的字符,默认为<code>&quot;...&quot;</code></li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text\": \"这是一段非常长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长的文字\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"text is ${text|truncate:10}\" // 输出: text is 这是一段非常长长长长...\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"url_encode\" href=\"#url_encode\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>url_encode</h3><p>效果同 <a href=\"https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent\">encodeURIComponent() - JavaScript | MDN</a></p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | url_encode}\n</code></pre><h3><a class=\"anchor\" name=\"url_decode\" href=\"#url_decode\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>url_decode</h3><p>效果同 <a href=\"https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent\">decodeURIComponent() - JavaScript | MDN</a></p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | url_decode}\n</code></pre><h3><a class=\"anchor\" name=\"default\" href=\"#default\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>default</h3><p>当变量值为空时,显示其他值代替。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | default[:defaultValue]}\n</code></pre><ul>\n<li><strong>defaultValue</strong>:显示的默认值</li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value\": \"\" // 或者是 null 或 undefined\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"value is ${value|default:-}\" // 输出: value is -\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"split\" href=\"#split\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>split</h3><p>可以将字符传通过分隔符分离成数组</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | split[:delimiter]}\n</code></pre><ul>\n<li><strong>delimiter</strong>:分隔值,默认为<code>,</code></li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": \"a,b,c\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"array is ${array|split|json}\" // 输出: array is [\"a\", \"b\", \"c\"]\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"join\" href=\"#join\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>join</h3><p>当变量值是数组时,可以把内容连接起来。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | join[:glue]}\n</code></pre><ul>\n<li><strong>glue</strong>:连接符,默认为<code>空字符</code></li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\"a\", \"b\", \"c\"]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"array is ${array|join}\" // 输出: array is abc\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E9%85%8D%E7%BD%AE%E8%BF%9E%E6%8E%A5%E7%AC%A6\" href=\"#%E9%85%8D%E7%BD%AE%E8%BF%9E%E6%8E%A5%E7%AC%A6\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>配置连接符</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\"a\", \"b\", \"c\"]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"array is ${array|join:-}\" // 输出: array is a,b,c\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"first\" href=\"#first\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>first</h3><p>获取数组中的第一个值</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | first}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\"a\", \"b\", \"c\"]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"first element is ${array|first}\" // 输出: first element is a\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"last\" href=\"#last\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>last</h3><p>获取数组中的最后一个值</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | last}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\"a\", \"b\", \"c\"]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"last element is ${array|last}\" // 输出: last element is c\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"nth\" href=\"#nth\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>nth</h3><p>获取数组中的第<code>n</code>个值</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | nth[:nth]}\n</code></pre><ul>\n<li><strong>nth</strong>:指定获取第几个值</li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\"a\", \"b\", \"c\"]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"second element is ${array|nth:1}\" // 输出: second element is b\n }\n}\n</script></div>\n<p><strong>注意:</strong> nth 配置<code>0</code>为获取第一个元素。</p>\n<h3><a class=\"anchor\" name=\"pick\" href=\"#pick\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>pick</h3><p>获取对象或数组中符合条件的筛选值</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | pick[:path]}\n</code></pre><ul>\n<li><strong>path:</strong> 指定筛选的模板,默认为<code>&amp;</code>,即返回原数据</li>\n</ul>\n<h5><a class=\"anchor\" name=\"%E5%9C%A8%E5%AF%B9%E8%B1%A1%E4%B8%AD%E8%8E%B7%E5%8F%96%E6%9F%90%E4%B8%AA-key-%E5%80%BC\" href=\"#%E5%9C%A8%E5%AF%B9%E8%B1%A1%E4%B8%AD%E8%8E%B7%E5%8F%96%E6%9F%90%E4%B8%AA-key-%E5%80%BC\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>在对象中获取某个 key 值</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"object\": {\n \"a\": 1,\n \"b\": 2,\n \"c\": 3\n }\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"a value of object is ${object|pick:a}\" // 输出: a value of object is 1\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E9%81%8D%E5%8E%86%E5%AF%B9%E8%B1%A1%E6%95%B0%E7%BB%84%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E5%80%BC\" href=\"#%E9%81%8D%E5%8E%86%E5%AF%B9%E8%B1%A1%E6%95%B0%E7%BB%84%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E5%80%BC\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>遍历对象数组获取指定值</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\n {\n \"a\": 1,\n \"b\": 2,\n \"c\": 3\n },\n {\n \"a\": 10,\n \"b\": 20,\n \"c\": 30\n },\n {\n \"a\": 100,\n \"b\": 200,\n \"c\": 300\n }\n ]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"new array is ${array|pick:a|json}\" // 输出: new array is [1, 10 ,100]\n }\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E9%81%8D%E5%8E%86%E6%95%B0%E7%BB%84%E5%AF%B9%E8%B1%A1-%E5%B9%B6%E8%87%AA%E5%AE%9A%E4%B9%89-key\" href=\"#%E9%81%8D%E5%8E%86%E6%95%B0%E7%BB%84%E5%AF%B9%E8%B1%A1-%E5%B9%B6%E8%87%AA%E5%AE%9A%E4%B9%89-key\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>遍历数组对象,并自定义 key</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"array\": [\n {\n \"aaa\": 1,\n \"bbb\": 2,\n \"ccc\": 3\n },\n {\n \"aaa\": 10,\n \"bbb\": 20,\n \"ccc\": 30\n },\n {\n \"aaa\": 100,\n \"bbb\": 200,\n \"ccc\": 300\n }\n ]\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"new array is ${array|pick:a~aaa,b~bbb|json}\"\n // 输出: new array is [ { \"a\": 1, \"b\": 2 }, { \"a\": 10, \"b\": 20 }, { \"a\": 100, \"b\": 200 } ]\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"duration\" href=\"#duration\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>duration</h3><p>秒值格式化成时间格式</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | duration}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"time1\": 2,\n \"time2\": 67,\n \"time3\": 1111111\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"time1 is ${time1|duration}\"\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"time2 is ${time2|duration}\"\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"time3 is ${time3|duration}\"\n }\n ]\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"asarray\" href=\"#asarray\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>asArray</h3><p>将数据包成数组</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | asArray}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value\": \"a\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"new value is ${value|asArray|json}\" // 输出: new value is [\"a\"]\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"lowercase\" href=\"#lowercase\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>lowerCase</h3><p>将字符串转小写</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | lowerCase}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text\": \"World\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"Hello ${text|lowerCase}\" // 输出: Hello world\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"uppercase\" href=\"#uppercase\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>upperCase</h3><p>将字符串转大写</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | upperCase}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text\": \"World\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"Hello ${text|upperCase}\" // 输出: Hello WORLD\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"base64encode\" href=\"#base64encode\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>base64Encode</h3><p>base64 加密</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | base64Encode}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text\": \"World\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"Hello ${text|base64Encode}\" // 输出: Hello V29ybGQ=\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"base64decode\" href=\"#base64decode\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>base64Decode</h3><p>base64 解密</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | base64Decode}\n</code></pre><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text\": \"V29ybGQ=\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"Hello ${text|base64Decode}\" // 输出: Hello World\n }\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"istrue\" href=\"#istrue\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>isTrue</h3><p>真值条件过滤器</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | isTrue[:trueValue][:falseValue]\n</code></pre><ul>\n<li><strong>trueValue</strong>: 如果变量为 <a href=\"https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy\">真</a>,即返回该值;</li>\n<li><strong>falseValue</strong>: 如果变量为 <a href=\"https://developer.mozilla.org/en-US/docs/Glossary/Falsy\">假</a>,则返回该值。</li>\n</ul>\n<blockquote>\n<p>配置<code>trueValue</code>和<code>falseValue</code>时,如果想要返回当前数据域中某个变量的值,那么参数可以直接配置变量名而不需要在两边添加引号;如果想返回某字符串,那么需要给参数两边添加单引号或双引号,</p>\n<p>例如 <code>${xxx|isTrue:&#39;foo&#39;:bar}</code>,当 <code>xxx</code> 变量为真,那么会返回 <strong>字符串<code>&#39;foo&#39;</code></strong>,如果不为真,那么返回数据域中 <strong>变量<code>bar</code></strong> 的值。</p>\n</blockquote>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value1\": true,\n \"value2\": false\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"value1${value1|isTrue:'是真':'是假'}\" // 输出: value是真\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"value2${value2|isTrue:'是真':'是假'}\" // 输出: value是真\n }\n ]\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E8%BF%94%E5%9B%9E%E6%95%B0%E6%8D%AE%E5%9F%9F%E4%B8%AD%E5%8F%98%E9%87%8F\" href=\"#%E8%BF%94%E5%9B%9E%E6%95%B0%E6%8D%AE%E5%9F%9F%E4%B8%AD%E5%8F%98%E9%87%8F\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>返回数据域中变量</h5><p>参数中不添加引号,可以直接返回数据域中变量值</p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value1\": true,\n \"value2\": false,\n \"trueValue\": \"这个值是真的\",\n \"falseValue\": \"这个值是假的\"\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"value1${value1|isTrue:trueValue:falseValue}\" // 输出: value是真\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"value2${value2|isTrue:trueValue:falseValue}\" // 输出: value是真\n }\n ]\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"isfalse\" href=\"#isfalse\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>isFalse</h3><p>假值条件过滤器</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | isFalse[:falseValue][:trueValue]\n</code></pre><p>用法与 <a href=\"#istrue\">isTrue 过滤器</a> 相同,判断逻辑相反</p>\n<h3><a class=\"anchor\" name=\"ismatch\" href=\"#ismatch\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>isMatch</h3><p>模糊匹配条件过滤器</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | isMatch[:matchParam][:trueValue][:falseValue]\n</code></pre><ul>\n<li><strong>matchParam</strong>: 匹配关键字参数<ul>\n<li>如果想模糊匹配特定字符串,那么参数需要在两边添加单引号或者双引号;</li>\n<li>如果想模糊匹配某个变量值,那么参数不需要添加引号。</li>\n</ul>\n</li>\n<li><strong>trueValue</strong>: 如果模糊匹配成功,即返回该值;</li>\n<li><strong>falseValue</strong>: 如果模糊匹配失败,则返回该值。</li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text1\": \"Hello\",\n \"text2\": \"World\"\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text1|isMatch:'hello':'匹配':'不匹配'}\" // 输出: 匹配\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text2|isMatch:'hello':'匹配':'不匹配'}\" // 输出: 匹配\n }\n ]\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E8%BF%94%E5%9B%9E%E6%95%B0%E6%8D%AE%E5%9F%9F%E4%B8%AD%E5%8F%98%E9%87%8F\" href=\"#%E8%BF%94%E5%9B%9E%E6%95%B0%E6%8D%AE%E5%9F%9F%E4%B8%AD%E5%8F%98%E9%87%8F\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>返回数据域中变量</h5><p>参数中不添加引号,可以直接返回数据域中变量值</p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text1\": \"Hello\",\n \"text2\": \"World\",\n \"matchValue\": \"这个值匹配上了\",\n \"notmatchValue\": \"这个值没有匹配上\"\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text1|isMatch:'hello':matchValue:notmatchValue}\" // 输出: 匹配\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text2|isMatch:'hello':matchValue:notmatchValue}\" // 输出: 匹配\n }\n ]\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"notmatch\" href=\"#notmatch\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>notMatch</h3><h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | notMatch[:matchParam][:trueValue][:falseValue]\n</code></pre><p>用法与 <a href=\"#ismatch\">isMatch</a> 相同,判断逻辑相反。</p>\n<h3><a class=\"anchor\" name=\"isequals\" href=\"#isequals\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>isEquals</h3><p>全等匹配过滤器</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | isEquals[:equalsValue][:trueValue][:falseValue]\n</code></pre><ul>\n<li><strong>equalsValue</strong>: 全等匹配关键字参数<ul>\n<li>如果想判断等于特定字符串,那么参数需要在两边添加单引号或者双引号;</li>\n<li>如果想判断等于某个变量值,那么参数不需要添加引号。</li>\n</ul>\n</li>\n<li><strong>trueValue</strong>: 如果模糊匹配成功,即返回该值;</li>\n<li><strong>falseValue</strong>: 如果模糊匹配失败,则返回该值。</li>\n</ul>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text1\": \"Hello\",\n \"text2\": \"hello\"\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text1|isEquals:'Hello':'等于':'不等于'}\" // 输出: 等于\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text2|isEquals:'Hello':'等于':'不等于'}\" // 输出: 等于\n }\n ]\n}\n</script></div>\n<h5><a class=\"anchor\" name=\"%E8%BF%94%E5%9B%9E%E6%95%B0%E6%8D%AE%E5%9F%9F%E4%B8%AD%E5%8F%98%E9%87%8F\" href=\"#%E8%BF%94%E5%9B%9E%E6%95%B0%E6%8D%AE%E5%9F%9F%E4%B8%AD%E5%8F%98%E9%87%8F\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>返回数据域中变量</h5><p>参数中不添加引号,可以直接返回数据域中变量值</p>\n<div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"text1\": \"Hello\",\n \"text2\": \"hello\",\n \"equalsValue\": \"这个值等于'Hello'\",\n \"notequalsValue\": \"这个值不等于'Hello'\"\n },\n \"body\": [\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text1|isEquals:'Hello':equalsValue:notequalsValue}\" // 输出: 等于\n },\n {\n \"type\": \"divider\"\n },\n {\n \"type\": \"tpl\",\n \"tpl\": \"${text2|isEquals:'Hello':equalsValue:notequalsValue}\" // 输出: 等于\n }\n ]\n}\n</script></div>\n<h3><a class=\"anchor\" name=\"notequals\" href=\"#notequals\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>notEquals</h3><p>不全等匹配过滤器</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | notEquals[:equalsValue][:trueValue][:falseValue]\n</code></pre><p>用法与 <a href=\"#isequals\">isEquals</a> 相同,判断逻辑相反。</p>\n<h3><a class=\"anchor\" name=\"filter\" href=\"#filter\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>filter</h3><p>过滤数组,操作对象为数组,当目标对象不是数组时将无效。</p>\n<h5><a class=\"anchor\" name=\"%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" href=\"#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基本用法</h5><pre><code>${xxx | filter[:keys][:directive][:arg1]}\n</code></pre><ul>\n<li><strong>keys</strong>: 参与过滤的字段集合</li>\n<li><strong>directive</strong>: 用于过滤数组的指令,包含下面这几种<ul>\n<li><code>isTrue</code> 目标值为真通过筛选。</li>\n<li><code>isFalse</code> 目标值为假时通过筛选。</li>\n<li><code>match</code> 模糊匹配后面的参数。<code>${xxx|filter:a,b:match:keywords}</code> 表示 xxx 里面的成员,如果字段 a 或者 字段 b 模糊匹配 keywords 变量的值,则通过筛选。</li>\n<li><code>equals</code> 相对于模糊匹配,这个就相对精确匹配了,用法跟 <code>match</code> 一样。</li>\n</ul>\n</li>\n<li><p><strong>arg1</strong>: 字符串或变量名</p>\n<p>比如: <code>${xxx|filter:readonly:isTrue}</code> 将 xxx 数组中 readonly 为 true 的成员提取出来。\n再来个栗子<code>${xxx|filter:a,b:match:keywords}</code> 将 xxx 数组中成员变量 a 或者 b 的值与环境中 keywords 的值相匹配的提取出来。如果不需要取变量,也可以写固定值如:<code>${xxx|filter:a,b:match:&#39;123&#39;}</code></p>\n</li>\n</ul>\n<h2><a class=\"anchor\" name=\"%E4%B8%B2%E8%81%94%E4%BD%BF%E7%94%A8%E8%BF%87%E6%BB%A4%E5%99%A8\" href=\"#%E4%B8%B2%E8%81%94%E4%BD%BF%E7%94%A8%E8%BF%87%E6%BB%A4%E5%99%A8\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>串联使用过滤器</h2><p>使用单一的过滤器可能无法满足你的所有需求,幸运的是 amis 支持串联使用过滤器,而前一个过滤器的值会作为下一个过滤器的入参,进行下一步处理。语法如下:</p>\n<pre><code>${xxx|filter1|filter2|...}\n</code></pre><h5><a class=\"anchor\" name=\"%E5%85%88%E6%8B%86%E5%88%86%E5%AD%97%E7%AC%A6%E4%B8%B2-%E5%86%8D%E8%8E%B7%E5%8F%96%E7%AC%AC-n-%E4%B8%AA%E5%80%BC\" href=\"#%E5%85%88%E6%8B%86%E5%88%86%E5%AD%97%E7%AC%A6%E4%B8%B2-%E5%86%8D%E8%8E%B7%E5%8F%96%E7%AC%AC-n-%E4%B8%AA%E5%80%BC\" aria-hidden=\"true\"><svg aria-hidden=\"true\" class=\"octicon octicon-link\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>先拆分字符串,再获取第 n 个值</h5><div class=\"amis-preview\" style=\"height: 400px\"><script type=\"text/schema\" height=\"400\">{\n \"type\": \"page\",\n \"data\": {\n \"value\":\"a,b,c\"\n },\n \"body\": {\n \"type\": \"tpl\",\n \"tpl\": \"${value|split|first}\" // 输出: a\n }\n}\n</script></div>\n<p>上例子中<code>${value|split|first}</code>,会经历下面几个步骤:</p>\n<ol>\n<li>会先执行<code>split</code>过滤器,将字符串<code>a,b,c</code>,拆分成数组<code>[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</code></li>\n<li>然后将该数据传给下一个过滤器<code>first</code>,执行该过滤器,获取数组第一个元素,为<code>&quot;a&quot;</code></li>\n<li>输出<code>&quot;a&quot;</code></li>\n</ol>\n",
"toc": {
"label": "目录",
"type": "toc",
"children": [
{
"label": "模板字符串",
"fragment": "%E6%A8%A1%E6%9D%BF%E5%AD%97%E7%AC%A6%E4%B8%B2",
"fullPath": "#%E6%A8%A1%E6%9D%BF%E5%AD%97%E7%AC%A6%E4%B8%B2",
"level": 2
},
{
"label": "支持链式取值",
"fragment": "%E6%94%AF%E6%8C%81%E9%93%BE%E5%BC%8F%E5%8F%96%E5%80%BC",
"fullPath": "#%E6%94%AF%E6%8C%81%E9%93%BE%E5%BC%8F%E5%8F%96%E5%80%BC",
"level": 2
},
{
"label": "自定义 api 请求体数据格式",
"fragment": "%E8%87%AA%E5%AE%9A%E4%B9%89-api-%E8%AF%B7%E6%B1%82%E4%BD%93%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F",
"fullPath": "#%E8%87%AA%E5%AE%9A%E4%B9%89-api-%E8%AF%B7%E6%B1%82%E4%BD%93%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F",
"level": 2
},
{
"label": "复杂配置",
"fragment": "%E5%A4%8D%E6%9D%82%E9%85%8D%E7%BD%AE",
"fullPath": "#%E5%A4%8D%E6%9D%82%E9%85%8D%E7%BD%AE",
"level": 2,
"children": [
{
"label": "展开所配置的数据",
"fragment": "%E5%B1%95%E5%BC%80%E6%89%80%E9%85%8D%E7%BD%AE%E7%9A%84%E6%95%B0%E6%8D%AE",
"fullPath": "#%E5%B1%95%E5%BC%80%E6%89%80%E9%85%8D%E7%BD%AE%E7%9A%84%E6%95%B0%E6%8D%AE",
"level": 3
},
{
"label": "数组提取值",
"fragment": "%E6%95%B0%E7%BB%84%E6%8F%90%E5%8F%96%E5%80%BC",
"fullPath": "#%E6%95%B0%E7%BB%84%E6%8F%90%E5%8F%96%E5%80%BC",
"level": 3
}
]
},
{
"label": "过滤器",
"fragment": "%E8%BF%87%E6%BB%A4%E5%99%A8",
"fullPath": "#%E8%BF%87%E6%BB%A4%E5%99%A8",
"level": 2,
"children": [
{
"label": "html",
"fragment": "html",
"fullPath": "#html",
"level": 3
},
{
"label": "raw",
"fragment": "raw",
"fullPath": "#raw",
"level": 3
},
{
"label": "json",
"fragment": "json",
"fullPath": "#json",
"level": 3
},
{
"label": "toJson",
"fragment": "tojson",
"fullPath": "#tojson",
"level": 3
},
{
"label": "date",
"fragment": "date",
"fullPath": "#date",
"level": 3
},
{
"label": "number",
"fragment": "number",
"fullPath": "#number",
"level": 3
},
{
"label": "trim",
"fragment": "trim",
"fullPath": "#trim",
"level": 3
},
{
"label": "percent",
"fragment": "percent",
"fullPath": "#percent",
"level": 3
},
{
"label": "round",
"fragment": "round",
"fullPath": "#round",
"level": 3
},
{
"label": "truncate",
"fragment": "truncate",
"fullPath": "#truncate",
"level": 3
},
{
"label": "url_encode",
"fragment": "url_encode",
"fullPath": "#url_encode",
"level": 3
},
{
"label": "url_decode",
"fragment": "url_decode",
"fullPath": "#url_decode",
"level": 3
},
{
"label": "default",
"fragment": "default",
"fullPath": "#default",
"level": 3
},
{
"label": "split",
"fragment": "split",
"fullPath": "#split",
"level": 3
},
{
"label": "join",
"fragment": "join",
"fullPath": "#join",
"level": 3
},
{
"label": "first",
"fragment": "first",
"fullPath": "#first",
"level": 3
},
{
"label": "last",
"fragment": "last",
"fullPath": "#last",
"level": 3
},
{
"label": "nth",
"fragment": "nth",
"fullPath": "#nth",
"level": 3
},
{
"label": "pick",
"fragment": "pick",
"fullPath": "#pick",
"level": 3
},
{
"label": "duration",
"fragment": "duration",
"fullPath": "#duration",
"level": 3
},
{
"label": "asArray",
"fragment": "asarray",
"fullPath": "#asarray",
"level": 3
},
{
"label": "lowerCase",
"fragment": "lowercase",
"fullPath": "#lowercase",
"level": 3
},
{
"label": "upperCase",
"fragment": "uppercase",
"fullPath": "#uppercase",
"level": 3
},
{
"label": "base64Encode",
"fragment": "base64encode",
"fullPath": "#base64encode",
"level": 3
},
{
"label": "base64Decode",
"fragment": "base64decode",
"fullPath": "#base64decode",
"level": 3
},
{
"label": "isTrue",
"fragment": "istrue",
"fullPath": "#istrue",
"level": 3
},
{
"label": "isFalse",
"fragment": "isfalse",
"fullPath": "#isfalse",
"level": 3
},
{
"label": "isMatch",
"fragment": "ismatch",
"fullPath": "#ismatch",
"level": 3
},
{
"label": "notMatch",
"fragment": "notmatch",
"fullPath": "#notmatch",
"level": 3
},
{
"label": "isEquals",
"fragment": "isequals",
"fullPath": "#isequals",
"level": 3
},
{
"label": "notEquals",
"fragment": "notequals",
"fullPath": "#notequals",
"level": 3
},
{
"label": "filter",
"fragment": "filter",
"fullPath": "#filter",
"level": 3
}
]
},
{
"label": "串联使用过滤器",
"fragment": "%E4%B8%B2%E8%81%94%E4%BD%BF%E7%94%A8%E8%BF%87%E6%BB%A4%E5%99%A8",
"fullPath": "#%E4%B8%B2%E8%81%94%E4%BD%BF%E7%94%A8%E8%BF%87%E6%BB%A4%E5%99%A8",
"level": 2
}
],
"level": 0
}
};
});