()
| 35 | } |
| 36 | |
| 37 | initRouter() { |
| 38 | const config = this.config; |
| 39 | const mode = config.routerMode || 'hash'; |
| 40 | let router; |
| 41 | |
| 42 | if (mode === 'history' && supportsPushState) { |
| 43 | router = new HTML5History(config); |
| 44 | } else { |
| 45 | router = new HashHistory(config); |
| 46 | } |
| 47 | |
| 48 | this.router = router; |
| 49 | this.updateRender(); |
| 50 | lastRoute = this.route; |
| 51 | |
| 52 | // eslint-disable-next-line no-unused-vars |
| 53 | router.onchange(params => { |
| 54 | this.updateRender(); |
| 55 | this._updateRender(); |
| 56 | |
| 57 | if (lastRoute.path === this.route.path) { |
| 58 | this.$resetEvents(params.source); |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | this.$fetch(noop, this.$resetEvents.bind(this, params.source)); |
| 63 | lastRoute = this.route; |
| 64 | }); |
| 65 | } |
| 66 | }; |
| 67 | } |
no test coverage detected