提问人:JeffP 提问时间:10/31/2023 更新时间:10/31/2023 访问量:19
flask:在特定模板中加载 JS 库,而不是在基本模板中加载
flask: Loading JS libraries in specific templates over loading in base template
问:
假设我有一个应用程序,而 Flask 是一个微型 Web 框架,我转向渲染我的表格(当然是用)。Flask
datatables
jquery
现在我的模板如下:
base.html (base template for all other templates)
index.html
other templates
users.html (this is the only template that uses datatables)
习惯上将使用的 JS 链接到模板。现在,考虑到只有一个 () 使用数据表( 和 ),如果我只在 users.html 中加载 jquery 和数据表,它会在加载时间方面对我的应用程序有益吗?base.html
users.html
datatables.js
jquery
目前,我正在基本模板中加载 JS 库。我还没有尝试对加载时间进行基准测试。
答: 暂无答案
评论
users.html