jQuery Word Export: missing dependency (FileSaver.js)
今天使用jQuery导出word的时候遇到这个问题。原来是单页面应用index.html引用js错误导致。因为html是从上至下顺序加载的所以这里需要调换两个js引入位置。
原来的引入
<script type="text/javascript" th:src="@{/scripts/libs/jquery-word/jquery.wordexport.js}"></script>
<script type="text/javascript" th:src="@{/scripts/libs/jquery-word/FileSaver.js}"></script>
修改过后的引入
<script type="text/javascript" th:src="@{/scripts/libs/jquery-word/FileSaver.js}"></script>
<script type="text/javascript" th:src="@{/scripts/libs/jquery-word/jquery.wordexport.js}"></script>
一定要注意FileSaver.js 和 jquery.wordexport.js的引入位置上的区别。