如何访问Mandrill数组中的特定项目?

时间:2019-05-16 17:55:25

标签: arrays mandrill

我想在Mandrill中访问数组中的特定项目。

"merge_vars": [
        {
            "rcpt": "someemail@gmail.com",
            "vars": [
                {
                    "name": "shoes",
                    "content": [
                        {
                            "id": 1026798092388,                               
                            "gender": "M",
                            "children": [
                                {
                                    "title": "BlackAndWhite",
                                    "sku": "",
                                    "id": 2252118491236,
                                    "atoms_status": "unfulfilled",
                                    "atoms_returned": false,
                                    "size": "9.5",
                                    "foot": "Left"
                                },
                                {
                                    "title": "BlackAndWhite",
                                    "sku": "",
                                    "id": 2252118524004,
                                    "atoms_status": "unfulfilled",
                                    "atoms_returned": false,
                                    "size": "9.5",
                                    "foot": "Right"
                                }
                            ]

尝试这样访问:

{{#each shoes}} 

   {{this.title}}<br>
   {{ #if `this.children[0].size != this.children[1].size` }}
      {{#each this.children}}                       
            foot: {{this.foot}}<br>
            size: {{this.size}}<br>
      {{/each}} 
   {{ else }}                     
         size: {{this.size}}<br>
   {{/if}}
{{/each}}     

不幸的是,这部分不起作用:

{{ #if `this.children[0].size != this.children[1].size` }}

0 个答案:

没有答案