【发布时间】:2017-06-16 10:35:30
【问题描述】:
我阅读了this 文档页面,了解如何包含 JQuery 之类的库。我是这样处理的:
npm install jquery
npm run dev
由于此后 JQuery 没有神奇地可用,我环顾四周,发现它在 public/js/app.js 中被引用和使用。所以我在主布局文件中使用了以下行,现在我可以使用 JQuery。
<script src="{{asset('js/app.js')}}"></script>
我在网上的任何地方都没有看到这样的解决方法,所以我的问题是,我做得对吗?此外,我在控制台中收到此错误:
TypeError: window.Laravel 未定义[了解更多] http://localhost/js/app.js:1697:1 webpack_require http://localhost/js/app.js:20:12 http://localhost/js/app.js:778:1 webpack_require http://localhost/js/app.js:20:12 http://localhost/js/app.js:41491:1 webpack_require http://localhost/js/app.js:20:12 http://localhost/js/app.js:66:18 http://localhost/js/app.js:1:11
【问题讨论】:
-
这是 laravel 5.4...