[英]Laravel, js in webpack.mix, function not found
I'm using Laravel 5.6. 我正在使用Laravel 5.6。 In webpack.mix.js I have this:
在webpack.mix.js中,我有这个:
.js([
'resources/assets/js/backend/before.js',
'resources/assets/js/backend/app.js',
'resources/assets/js/backend/after.js',
'resources/assets/js/backend/funcionesJquery.js',//THIS IS NEW
'resources/assets/js/backend/events.js',
], 'public/js/backend.js')
Ok, now functioncesJquery.js is only this: 好的,现在functioncesJquery.js就是这样:
alert("LOADEAD");
function testAlert(){
alert("TEST");
}
Now in a view I have this: 现在看来,我有这个:
@push('after-scripts')
<script>
testAlert();
</script>
@endpush
When I load the page with that view, it shows the alert("LOADEAD");
当我使用该视图加载页面时,它会显示
alert("LOADEAD");
but I'm getting a function not found anyway with testAlert()
. 但是我得到了一个无论如何都
testAlert()
找到的函数。 Why is happening that? 为什么会这样呢? the code is well loaded but why it doesn't find the function.
该代码加载良好,但为什么找不到该功能。
Because function not working without a call. 因为函数没有调用就无法工作。 You can try it.
你可以试试。 Thanks
谢谢
$(document).ready(function() {
$(document).on("keydown", disableF5);
var testAlert='';
if(testAlert==''){
testAlert();
}
});
function testAlert(){
alert("IS NULL");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.