Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanowon committed Jul 7, 2019
1 parent 06f989c commit be08e94
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/ch12/routertest_splash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
Expand Down
14 changes: 3 additions & 11 deletions examples/ch12/routertest_splash/src/components/ContactByNo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,13 @@ export default {
contacts : contactlist.contacts
}
},
created : function() {
this.no = this.$route.params.no;
},
watch : {
'$route'(to) {
this.no = to.params.no;
}
},
computed : {
contact : function() {
var no = this.no;
var no = parseInt(this.$route.params.no);
var arr = this.contacts.filter(function(item) {
return item.no == no;
return item.no === no;
});
if (arr.length == 1) return arr[0];
if (arr.length === 1) return arr[0];
else return {};
}
}
Expand Down
3 changes: 2 additions & 1 deletion examples/ch12/routertest_splash/src/components/Splash.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<vue-element-loading :active="true" spinner="bar-fade-scale" is-full-screen />
<vue-element-loading :active="true" spinner="bar-fade-scale"
background-color="#FFFFFF" color="#000000" is-full-screen />
</template>

<script>
Expand Down
7 changes: 3 additions & 4 deletions examples/ch12/routertest_splash/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import App from './App.vue'
import 'bootstrap/dist/css/bootstrap.css'
import VueRouter from 'vue-router'
import store from './store';
import Constant from './Constant';

Vue.config.productionTip = false
Vue.use(VueRouter);
Expand Down Expand Up @@ -54,14 +55,12 @@ const router = new VueRouter({
})

router.beforeEach((to,from,next)=> {
//store.dispatch(Constant.CHANGE_ISLOADING, { isloading: true })
store.state.isloading = true;
store.dispatch(Constant.CHANGE_ISLOADING, { isloading: true })
next();
})

router.afterEach(()=> {
//store.dispatch(Constant.CHANGE_ISLOADING, { isloading: false })
store.state.isloading = false;
store.dispatch(Constant.CHANGE_ISLOADING, { isloading: false })
})


Expand Down
2 changes: 1 addition & 1 deletion examples/ch12/routertest_splash/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const store = new Vuex.Store({
},
actions : {
[Constant.CHANGE_ISLOADING] : (store, payload)=> {
store.dispatch(Constant.CHANGE_ISLOADING, payload);
store.commit(Constant.CHANGE_ISLOADING, payload);
}
}
})
Expand Down

0 comments on commit be08e94

Please sign in to comment.