Shopify(液体):语法错误,预期为close_square,但发现逗号

时间:2018-11-20 19:39:13

标签: shopify liquid

我正在Shopify(液体)中创建一个数组,但出现错误

            {% assign numbers = [   
                                    "One", 
                                    "TWo", 
                                    "three",
                                    "bla"                                   
                                 ] 
            %}
  

第126行-液体语法错误:预期为close_square,但发现逗号   在“ {{[“ One”,“ TWo”,“三个”,“ bla”]}}“

1 个答案:

答案 0 :(得分:2)

无法在液体中创建这样的数组。

相反,您可以使用Array [ Object { "ARCDATE": "", "ARCHFIN1": "true", "ARCHFIN2": "true", "ARCHFIN3": "true", "ARCHFIN4": "true", "ARCHFIN5": "true", "ARCHINS1": "true", "ARCHINS2": "true", "ARCHITRAVE": "true", "DEFPINTULEBAR": 90, "DEFPINTUPANJANG": 200, "DOORSTOP": "false", "DSDATE": "", "ENDDATE": "2018-12-18T17:00:00.000Z", "GLOBALSTATUS": 0, "HANDATE": "", "HANDLE": "true", "KET": "", "KETARCHI": "", "KETDOORSTOP": "", "KETHANDLE": "", "KETKUSEN": "", "KETPINTU": "", "KUSDATE": "", "KUSEN": "true", "KUSENFIN1": "false", "KUSENFIN2": "true", "KUSENFIN3": "true", "KUSENFIN4": "true", "KUSENFIN5": "true", "KUSENGMBR": "", "KUSENINS1": "true", "KUSENINS2": "false", "KUSENINS3": "false", "KUSENINS4": "true", "LASTUPDATE": "2018-10-31T17:00:00.000Z", "LT": "1", "NO": 53, "NOKAMAR": 107, "NP": "Novotel", "PINTU": "true", "PINTUDATE": "", "PINTUFIN1": "true", "PINTUFIN2": "true", "PINTUFIN3": "true", "PINTUFIN4": "true", "PINTUFIN5": "true", "PINTUGMBR": "", "PINTUINS1": "true", "PINTUINS2": "true", "PINTUINS3": "true", "PINTUINS4": "true", "PINTUINS5": "true", "REV": "", "SEALENT": "true", "SEALENTRAPIH": "true", "STARTDATE": "2018-10-31T17:00:00.000Z", "STATUS": 0, "SUBKON": "SUBKON A", "UKURANPINTUST": 0, "UPINTULEBAR": 90, "UPINTULEBAR2": 90, "UPINTULEBAR3": 90, "UPINTUPANJANG": 200, }, ] 过滤器从字符串创建数组。

split

您还可以创建一个空数组,并使用{% assign numbers = "one,two,three,four" | split: "," %} <pre>{{ numbers | inspect }}</pre> 过滤器

push