将Laravel 7和Vue SPA应用程序部署到共享主机中
专家们, 我的应用程序有Vue前端和Laravel 7后端。问题是,我无法重定向到登录页面,它会显示一个空白屏幕。所有Vue文件都位于resource/js文件夹中。前端和后端没有单独的文件夹 网络选项卡 控制台日志 文件夹结构:将Laravel 7和Vue SPA应用程序部署到共享主机中,laravel,vue.js,single-page-application,vue-router,shared-hosting,Laravel,Vue.js,Single Page Application,Vue Router,Shared Hosting,专家们, 我的应用程序有Vue前端和Laravel 7后端。问题是,我无法重定向到登录页面,它会显示一个空白屏幕。所有Vue文件都位于resource/js文件夹中。前端和后端没有单独的文件夹 网络选项卡 控制台日志 文件夹结构: 根目录有quickpack文件夹 在public\u html文件夹中有my Laravel应用程序的public文件 到目前为止我所做的: AppServiceProvider.php public function boot() { $this-&
- 根目录有quickpack文件夹
- 在public\u html文件夹中有my Laravel应用程序的public文件
public function boot()
{
$this->app->bind('path.public', function() {
return base_path().'/../public_html/netlinkler/quickpack';
});
}
app.js
require('./bootstrap');
window.Vue = require('vue')
import store from './store'
import router from './router'
import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';
Vue.use(ViewUI);
import common from './common';
Vue.mixin(common);
Vue.component('mainapp', require('./components/mainapp.vue').default)
const app = new Vue({
el: '#hmp',
router,
store
});
欢迎使用.blade.php
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Delivery App</title>
<link rel="stylesheet" href="{{asset('/css/all.css')}}">
</head>
<body>
<div id="hmp">
@if(Auth::guard('employee')->check())
<mainapp :user="{{Auth::guard('employee')->user()}}"></mainapp>
@else
<mainapp :user="false"></mainapp>
@endif
</div>
</body>
<script src="{{ mix('/js/app.js') }}"> </script>
</html>
web.php
Route::get('/', 'EmployeesController@index');
Auth::routes();
路由器.js
const routes = [
{
path: '/home',
component: home
},
{
path: '/login',
component: login
}
]
export default new Router({
mode: "history",
baseurl: "/api/v1",
base: 'deliverywebapp',
routes
})
您需要将应用程序文件夹添加到路由路径 或者可以添加基本路径 导出默认新路由器({ 常数路由=[
{
path: '/home',
component: home
},
{
path: '/login',
component: login
}
{
path: '/deliverywebapp/home',
component: home
},
{
path: '/deliverywebapp/login',
component: login
}
]
})
或
导出默认新路由器({
常数路由=[
{
path: '/home',
component: home
},
{
path: '/login',
component: login
}
{
path: '/deliverywebapp/home',
component: home
},
{
path: '/deliverywebapp/login',
component: login
}
]
})在
laravel.log
中有什么内容吗?您是否也可以发布XHR登录请求?您好,lost.design。XHR请求中没有任何内容。您的控制台中有什么?从第一个屏幕截图中可以看出有4个错误。lost.design更新了问题。thanksI已在AppServiceProvider.php中设置公用文件夹路径。这还不够吗?
{
path: '/deliverywebapp/home',
component: home
},
{
path: '/deliverywebapp/login',
component: login
}