在Laravel加载动态组件时遇到问题。始终从该URL加载组件:
http://localhost/js/admin/login.js?id=ba0d9bc8cd7797b0046c
组件应通过以下URL加载:
http://localhost/konsultasi/js/admin/login.js?id=ba0d9bc8cd7797b0046c
我没有在Artisan Serve上运行Laravel,我只是更改了htaccess文件,以便它可以重定向到公共目录。
这是我的mix-manifest.json
{
"/js/admin/login.js": "/js/admin/login.js?id=ba0d9bc8cd7797b0046c",
"/js/vendor.js": "/js/vendor.js",
"/js/admin/app.js": "/js/admin/app.js",
"/css/admin.css": "/css/admin.css",
"/js/admin/adminlte.js": "/js/admin/adminlte.js",
"/js/manifest.js": "/js/manifest.js"
}
这就是我的刀片视图如何调用javascript
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inspektorat | Konsultasi</title>
<link href="{!! asset('css/admin.css') !!}" rel="stylesheet">
<script src="{!! asset(mix('js/manifest.js')) !!}"></script>
<script src="{!! asset(mix('js/vendor.js')) !!}"></script>
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-box-body">
<div class="login-logo">
<img src="{!! url('img/logo.png') !!}" style="width:50%;">
</div>
<div id="app">
<login></login>
</div>
</div>
</div>
<script src="{!! asset(mix('js/admin/app.js')) !!}"></script>
</body>
</html>
在这一点上。我遇到了这个错误
http://localhost/js/admin/login.js?id=ba0d9bc8cd7797b0046c net::ERR_ABORTED 404 (Not Found)
和
vendor.js:11470 [Vue warn]: Failed to resolve async component: function Login() {
return __webpack_require__.e/* import() */(26).then(__webpack_require__.bind(null, 28));
}
Reason: Error: Loading chunk 26 failed.
答案 0 :(得分:0)
请尝试以下四个命令来清除缓存:
清除应用程序缓存:php artisan cache:clear
清除路由缓存:php artisan route:cache
清除配置缓存:php artisan config:cache
清除编译的视图文件:php artisan view:clear