Jadeベースの選択フィールドにデータを入力するためのより良い方法はありますか?私は現在この例を使用しています。テンプレートコードを台無しにしないためのより良い方法はありますか?
アイテムの値は「日」の例です。
select
repeation = [ 'no-repeat', 'day', 'week', 'month']
for item in repeation
if job.repeat == item
option(selected="true") #{item}
else
option #{item}
また、アイテムが['day'、'week']の配列である場合、複数の選択を表示するのはどうですか?
//複数の要素の可能な小さなソリューションを編集します
enginges = [ 'google', 'bing', 'yahoo', 'duckduckgo']
for engine in enginges
option(selected=job.sources.indexOf(engine) != -1) #{engine}