summaryrefslogtreecommitdiffstats
path: root/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/vuejs-cli/src/main.js
blob: c963425730966fbeae2a0e789d6cdffc0bc06cdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import Director from 'director/build/director'

/* eslint-disable no-new */
window.VueApp = new Vue({
    el: '#app',
    render: h => h(App)
})

const router = new Director.Router();

['all', 'active', 'completed'].forEach(visibility => {
  router.on(visibility, () => {
    window.VueApp.filter = visibility;
  });
});

router.configure({
  notfound: function () {
    window.location.hash = '';
    window.VueApp.filter = 'all';
  }
});

router.init();