Fil*_*tny 5 django attributes django-widget requirejs
我的大多数JavaScript都使用AMD与requirejs一起加载,但是在Django的小部件中使用它们时遇到了麻烦。
Django的文档指出,应通过以下方式嵌入媒体:
class Media:
js = ('animations.js')
Run Code Online (Sandbox Code Playgroud)
这将创建以下html:
<script type="text/javascript" src="http://static.example.com/animations.js"></script>
Run Code Online (Sandbox Code Playgroud)
但是,如果我想要这个怎么办?
<script data-main="scripts/animations" src="scripts/require.js"></script>
Run Code Online (Sandbox Code Playgroud)
如何告诉django插入data-main属性?
谢谢您的回答。
| 归档时间: |
|
| 查看次数: |
157 次 |
| 最近记录: |