我有项目开发与vue线索在开发模式下工作良好。但当我建造它的时候。没有路由加载的组件('/',组件),一切都很好。我的代码中有什么错误?
import Vue from 'vue'
import App from './App'
import router from './router/index'
Vue.config.productionTip = false
new Vue({
router,
template: '<App/>',
components: { App }
}).$mount('#app')和
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home.vue'
import List from '@/components/List.vue'
const router = new Router({
mode: 'history',
routes: [
{
path: '/',
component: Home
},
{
path: '/buy-n-sell/:category',
component: List,
children: [
{
path: '',
component: catLists
},
{
path: 'location/:city',
component: cityLists,
name: 'citypostList'
},
{
path: 'subcategory/:subcat',
component: subcatList,
name: 'subcatpostList'
},
{
path: 'subcategory/:subcat/:city',
component: subcatCityList,
name: 'subcatecityList'
}
]
}
]
})
export default router发布于 2017-05-19 17:47:46
我猜你需要处理历史模式的重写才能工作check https://router.vuejs.org/en/essentials/history-mode.html
nginx:
location / {
try_files $uri $uri/ /index.html;
}apache (create /dist/.htaccess)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>发布于 2018-10-10 18:37:13
在Lumen中,在web.php路由文件的末尾添加Route::get('/{vue_capture:[/\w.-]*}', function () { return view('pages.home'); });。
您可能还想在laracasts上检查此Link
https://stackoverflow.com/questions/43603131
复制相似问题