Mobile browsers shows blank page for the vuetify application

Refresh

November 2018

Views

255 time

2

Here is my package.json:

{
  "name": "DFS",
  "version": "1.0.0",
  "description": "DFS App",
  "author": "asd",
  "private": true,
  "nodemonConfig": {
    "delay": "2500"
  },
  "scripts": {
    "postinstall": "npm run build",
    "dev": "node build/dev-server.js",
    "start": "node build/dev-server.js",
    "build": "node build/build.js",
    "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
    "e2e": "node test/e2e/runner.js",
    "test": "npm run unit && npm run e2e",
    "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
    "deploy": "git subtree push --prefix dist heroku master"
  },
  "dependencies": {
    "axios": "^0.16.2",
    "connect-history-api-fallback": "^1.5.0",
    "express-sslify": "^1.2.0",
    "global": "^4.3.2",
    "heroku-ssl-redirect": "0.0.4",
    "less": "^3.0.1",
    "less-loader": "^4.0.5",
    "node-sass": "^4.7.2",
    "npm-watch": "^0.3.0",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.20.2",
    "vee-validate": "^2.0.0-rc.14",
    "vue": "^2.3.3",
    "vue-router": "^2.3.1",
    "vuetify": "^1.0.3",
    "vuex": "^3.0.1",
    "webpack-dev-server": "^3.0.0",
    "webpack-watch": "^0.2.0"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^7.1.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-istanbul": "^4.1.1",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chai": "^3.5.0",
    "chalk": "^2.0.1",
    "chromedriver": "^2.27.2",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^5.0.1",
    "cross-spawn": "^5.0.1",
    "css-loader": "^0.28.0",
    "cssnano": "^3.10.0",
    "eslint": "^3.19.0",
    "eslint-config-standard": "^6.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.7.1",
    "eslint-plugin-html": "^3.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.2.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^2.0.1",
    "eslint-plugin-vue": "^4.0.0",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.14.1",
    "extract-text-webpack-plugin": "^2.0.0",
    "file-loader": "^0.11.1",
    "friendly-errors-webpack-plugin": "^1.1.3",
    "html-webpack-plugin": "^2.28.0",
    "http-proxy-middleware": "^0.17.3",
    "inject-loader": "^3.0.0",
    "karma": "^1.4.1",
    "karma-coverage": "^1.1.1",
    "karma-mocha": "^1.3.0",
    "karma-phantomjs-launcher": "^1.0.2",
    "karma-phantomjs-shim": "^1.4.0",
    "karma-sinon-chai": "^1.3.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "0.0.31",
    "karma-webpack": "^2.0.2",
    "lolex": "^2.0.0",
    "mocha": "^3.2.0",
    "nightwatch": "^0.9.12",
    "node-notifier": "^5.1.2",
    "opn": "^5.1.0",
    "optimize-css-assets-webpack-plugin": "^2.0.0",
    "ora": "^1.2.0",
    "phantomjs-prebuilt": "^2.1.15",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "rimraf": "^2.6.0",
    "selenium-server": "^3.0.1",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "sinon": "^2.1.0",
    "sinon-chai": "^2.8.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "sw-precache-webpack-plugin": "^0.11.4",
    "ts-loader": "^3.5.0",
    "uglify-es": "^3.0.25",
    "url-loader": "^0.5.8",
    "vue-loader": "^12.1.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.3.3",
    "webpack": "^2.6.1",
    "webpack-bundle-analyzer": "^2.2.1",
    "webpack-cli": "^2.0.9",
    "webpack-dev-middleware": "^1.10.0",
    "webpack-hot-middleware": "^2.18.0",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

My main.js:

import Vue from 'vue'
import Vuetify from 'vuetify' // eslint-disable-line no-unused-vars
// import App from './App'
// import router from './router'

Vue.use(Vuetify)

// Vue.config.productionTip = false

new Vue({ // eslint-disable-line no-new
  el: '#app',
  // router,
  template: '<div>hi there</div>'
  // components: { App },
  // template: '<App/>'
})

My App.vue

<template>
  <div>
    123
  </div>
</template>

<script>
  export default {
    name: 'App'
  }
</script>

I am using Heroku for the app hosting. When I try to visit site with desktop browser all is okay, but when I try to load it via mobile browser it shows the blank page. For the other hand deploying this repo: https://github.com/deepak-singh/vue-blog-pwa is successfully done and loading via mobile or desktop browser is successful.

Also I found that this line causes blank page in my vue app:

Vue.use(Vuetify)

But! This line is present in vue-pwa-blog repo file. So I can not understand what may I doing wrong?

2 answers

0

Мои маршрутизаторы, как это:

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/index.html',
      name: 'HelloWorld',
      component: HelloWorld
    }
  ]
})

Тем не менее пустая страница .. Если я удалить мой Vue.use (Vuetify) из main.js работает ..

Package.json ->

  "dependencies": {
    "vue": "^2.5.2",
    "vue-router": "^3.0.1",
    "vuetify": "^1.1.6"
  },
0

Это происходит потому, что при установке и открыл PWA по телефону он переписывает URL в /index.html а vuetify приложение оказывается на /.

Просто повторно настроить VUE-маршрутизатор для загрузки компоненты в /index.html тоже, и он должен работать.

Ваш router.js может выглядеть следующим образом:

{
  path: '/',
  name: 'App',
  component: App
},
{
  path: '/index.html',
  name: 'App',
  component: App
}