Browse Source

判断段落列表里是否有内容

visuddhinanda 3 years ago
parent
commit
ad618deba1
1 changed files with 10 additions and 8 deletions
  1. 10 8
      public/app/term/related_para.js

+ 10 - 8
public/app/term/related_para.js

@@ -46,14 +46,16 @@ function related_para_dlg_render(para) {
 					paraList.push(ipara);
 				}
 			}
-			output +=
-				"<a href='../reader/?view=chapter&book=" +
-				paraList[0].book +
-				"&par=" +
-				paraList[0].para +
-				"' target='_blank'>" +
-				iterator.title +
-				"</a>";
+			if(paraList.length>0){
+				output +=
+					"<a href='../reader/?view=chapter&book=" +
+					paraList[0].book +
+					"&par=" +
+					paraList[0].para +
+					"' target='_blank'>" +
+					iterator.title +
+					"</a>";				
+			}
 		}
 		output += "</div>";
 	}