在首页添加显示问答的列表,并定义好相应的样式。
无序列表
<ul >
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
2. 用字典向index.html传递参数。
py:
def index():
context = {
'question':'hehehahaxixihoho'
}
return render_template('index.html',**context)
html:
<form class="">
<ul class="list-group list-group-item-light p-3 border border-secondary rounded-top" style="margin-top: 6.2% ; margin-left: 25%;width: 50%; ">
<li class="list-group-item rounded m-1" style="height: 10ch">
<span>
<a href="#">title</a>
<p>detail{{ question }}</p>
</span>
</li>
</ul>
</form>