[英]Uncaught ReferenceError: route is not defined in Laravel 8
require('./bootstrap');
require('./ziggy');
window.Vue = require('vue');
const files = require.context('./', true, /\.vue$/i);
files.keys().map(key => {
return Vue.component(_.last(key.split('/')).split('.')[0], files(key))
});
const app = new Vue({
el: '#app',
})
Vue.mixin({
methods: {
route: route
}
});
安装 Laravel 8 身份验证后,我在控制台中收到此错误。
app.js:63273 Uncaught ReferenceError: route is not defined at Module../resources/js/app.js (app.js:63273) at webpack_require (app.js:20) at Object.0 (app.js:63334 ) 在 webpack_require (app.js:20) 在 app.js:84 在 app.js:87 app.js:58049
下载 Vue Devtools 扩展以获得更好的开发。 因此,我的 JavaScript 无法正常工作。 我必须点击 URL 来获取身份验证模块。
之所以会发生这种情况,是因为这段代码。 你没有声明route
变量。 因此,它会引发错误。
Vue.mixin({
methods: {
route: route
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.