File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * register plugins hooks for vue component
3
+ */
4
+
5
+ import { Component } from 'vue-property-decorator'
6
+
7
+ Component . registerHooks ( [
8
+ 'beforeRouteEnter' ,
9
+ 'beforeRouteLeave'
10
+ ] )
Original file line number Diff line number Diff line change @@ -16,5 +16,15 @@ export default class Home extends Vue {
16
16
let res = await this . api . getPackage ( { } )
17
17
console . log ( res . content )
18
18
}
19
+
20
+ beforeRouteEnter ( to , from , next ) {
21
+ console . log ( 'before home enter' )
22
+ next ( )
23
+ }
24
+
25
+ beforeRouteLeave ( to , from , next ) {
26
+ console . log ( 'before home leave' )
27
+ next ( )
28
+ }
19
29
}
20
30
Original file line number Diff line number Diff line change 2
2
import 'vue-svgicon/dist/polyfill'
3
3
{ { / i e } }
4
4
import Vue from 'vue'
5
- import App from 'components/pages/app'
5
+
6
+ // register plugins hooks fo vue component
7
+ import 'common/registerHooks'
8
+
9
+ import * as svgicon from 'vue-svgicon'
10
+ // import all icons
11
+ import 'components/icons'
12
+
6
13
import router from 'router'
7
- import svgicon = require( 'vue-svgicon' )
8
14
{ { #vuex} }
9
15
import store from 'store'
10
16
{ { / v u e x } }
11
17
18
+ import App from 'components/pages/app'
19
+
12
20
// import all icons
13
21
import 'components/icons'
14
22
Vue . use ( svgicon , {
@@ -23,4 +31,3 @@ new Vue({
23
31
{ { / v u e x } }
24
32
render : h => h ( App )
25
33
} )
26
-
You can’t perform that action at this time.
0 commit comments