Use a loader when lazy loading Map view, to ensure a direct feedback is given to the user
This commit is contained in:
parent
b06ba60816
commit
718791e95f
@ -4,13 +4,12 @@ import Router from 'vue-router';
|
|||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
|
|
||||||
import About from '@/views/About.vue';
|
import About from '@/views/About.vue';
|
||||||
|
import LazyMap from '@/views/LazyMap.vue';
|
||||||
import Onboarding from '@/views/Onboarding.vue';
|
import Onboarding from '@/views/Onboarding.vue';
|
||||||
import Settings from '@/views/Settings.vue';
|
import Settings from '@/views/Settings.vue';
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
const Map = () => import('@/views/Map.vue');
|
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
@ -21,12 +20,12 @@ export default new Router({
|
|||||||
{
|
{
|
||||||
path: '/map=:zoom/:lat/:lng',
|
path: '/map=:zoom/:lat/:lng',
|
||||||
name: 'SharedMap',
|
name: 'SharedMap',
|
||||||
component: Map,
|
component: LazyMap,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/map',
|
path: '/map',
|
||||||
name: 'Map',
|
name: 'Map',
|
||||||
component: Map,
|
component: LazyMap,
|
||||||
beforeEnter: (to, from, next) => {
|
beforeEnter: (to, from, next) => {
|
||||||
if (to.name !== 'SharedMap') {
|
if (to.name !== 'SharedMap') {
|
||||||
// Check that intro was seen except if we are in SharedMap view.
|
// Check that intro was seen except if we are in SharedMap view.
|
||||||
|
16
src/views/LazyMap.vue
Normal file
16
src/views/LazyMap.vue
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<template>
|
||||||
|
<Map></Map>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Loading from '@/views/Loading.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Map: () => ({
|
||||||
|
component: import('@/views/Map.vue'),
|
||||||
|
loading: Loading,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
19
src/views/Loading.vue
Normal file
19
src/views/Loading.vue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<v-container fluid fill-height class="no-padding">
|
||||||
|
<v-layout row wrap fill-height>
|
||||||
|
<v-flex xs12 class="text-xs-center">
|
||||||
|
<v-progress-circular
|
||||||
|
:size="70"
|
||||||
|
:width="7"
|
||||||
|
color="blue"
|
||||||
|
indeterminate
|
||||||
|
></v-progress-circular>
|
||||||
|
</v-flex>
|
||||||
|
</v-layout>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user