且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

验证json文件中的小胡子标记值

更新时间:2023-12-01 08:12:34

在胡须中是不可能的,因为其逻辑较少.改为使用 handlebarsjs .

Its not possible in mustache as its logic less. Use handlebarsjs instead.

如果您仍然想在小胡子上做到这一点,那么:

If you still want to achieve this in mustache then:

您不能使用任何if语句,但是可以检查是否存在任何东西或它的值为true.

You can not use any if statement but you can check if anything exist or its value is true.

在这种情况下,您必须像这样更新json:

if this case you have to update json like:

{ "weeks": [    {
      "monday800": "no",
      "monday830": "available",
      "monday830_available": true, // you have to add another property here
      "tuesday800": "available",
      "tuesday830": "no",
      "name": "TEST"
     }
   ]
 }

然后您可以检查

{{#monday830_available}}
     ..............
{{/monday830_available}}