在app.js文件非常大的时候使用,否则会影响性能

component: () => import('@/pages/home/Home')
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('@/pages/home/Home')
    },
    {
      path: '/city',
      name: 'City',
      component: () => import('@/pages/city/City')
    },
    {
      path: '/detail/:id',
      name: 'Detail',
      component: () => import('@/pages/detail/Detail')
    },
    {
      path: '/test',
      name: 'Test',
      component: () => import('@/pages/test/Test')
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})

修改config/index.js build下的 assetsPublicPath: '/' 为服务器端项目存放的目录
运行npm run build打包
将dist文件夹下文件上传服务器

package.json
为dev添加--host 0.0.0.0

 "scripts": {
    "dev": "webpack-dev-server --host 0.0.0.0 --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "lint": "eslint --ext .js,.vue src",
    "build": "node build/build.js"
  },

然后使用手机访问pc ip地址即可