Cannot GET /app

来源:6-1 notification之基本组件实现

错爱谁

2018-06-14

http://localhost:3333/app 访问正常 但到http://localhost:8000/app就提示Cannot GET /app

create-app.js :

import Vue from 'Vue'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import Meta from 'vue-meta'

import App from './app.vue'
import createStore from './store/store'
import createRouter from './config/router'
import Notification from './components/notification'

import './assets/styles/global.styl'

Vue.use(VueRouter)
Vue.use(Vuex)
Vue.use(Meta)
Vue.use(Notification)

export default () => {
  const router = createRouter()
  const store = createStore()

  const app = new Vue({
    router,
    store,
    render: h => h(App)
  })

  return { app, router, store }

}

client-entry.js :

import createApp from './create-app'

const { app, router } = createApp()

router.onReady(() => {
  app.$mount('#root')
})


写回答

2回答

Jokcy

2018-06-14

你的dev-server没有配置historyApiFallback吧

0
7
错爱谁
非常感谢!
2018-06-22
共7条回复

慕无忌6890528

2019-04-18

historyApiFallback: { index: '/pubilc/index.html' }, 

这里的路径写错了应该是:

historyApiFallback: {

    index: '/index.html'

},


1
0

Vue核心技术 Vue+Vue-Router+Vuex+SSR实战精讲

深入讲解Vue核心技术,展示Vue应用开发中的各种问题和解决方案

3168 学习 · 853 问题

查看课程