Flask 中支持?flask-bootstrap模板 和?bootstrap-flask模板
# 不使用: bootstrap-flask
# pip install bootstrap-flask==1.3.1 # 支持bootstrap 4
# pip install flask-bootstrap # 支持bootstrap3
# 中文文檔:
https://flask-bootstrap-zh.readthedocs.io/zh/latest/
# 樣式文檔:
https://v3.bootcss.com/getting-started/#download
一. flask-bootstrap 模板使用
? ? ? ? (1).?下載:?pip install flask-bootstrap
? ? ? ? (2).??在?ext / __init__.py中 創(chuàng)建bootstrap對象
? ? ? ? (3).? 在?apps/__init__.py中 初始化bootstrap
文章來源:http://www.zghlxwxcb.cn/news/detail-679163.html
二. flask-bootstrap內(nèi)置block
// bootstrap內(nèi)置的block
{% block title %}標(biāo)題{% endblock %}
{% block navbar %}導(dǎo)航欄{% endblock %}
{% block content %}中心內(nèi)容{% endblock %}
{% block styles %}樣式{% endblock %}
{% block srcipts %}腳本{% endblock %}
{% block head %}頭{% endblock %}
{% block body %}體{% endblock %}
// styles 和 scripts 需要繼承父模板
// 添加css腳本
{% block styles %}
{{ super() }} // 繼承腹肌樣式
<style> //定義自己樣式
...
</style>
{% endblock %}
// 添加js腳本
{% block scripts %}
{{ super() }}
<script>
...
</script>
{% endblock %}
三. 代碼實例
文章來源地址http://www.zghlxwxcb.cn/news/detail-679163.html
到了這里,關(guān)于16- flask-bootstrap模板的使用的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!