實現上述功能,針對症狀的item最后☝️沒有分割線,
首先聲明一點,小程序不支持 CSS3里面的nth-child()選擇器。
數據結構如下:
item.indications:[
{ id: "K29.501", name: "慢性胃炎", type: "EntityTypeDisease" },
{ id: "腹痛1", name: "腹痛1", type: "EntityTypeSymptom" },
{ id: "腹痛2", name: "腹痛2", type: "EntityTypeSymptom" }
]
type=='EntityTypeSymptom'為症狀的json,所以,循環的時候需要增加判斷,最后需要判斷長度-1的時候去掉分割線。
具體代碼實現如下

注意:截圖代碼有誤:index==item.indications.length-1;