Blame view

test/main.js 1.7 KB
7fa943eb   梁灏   init
1
2
3
4
5
  /**
   * Created by aresn on 16/6/20.
   */
  import Vue from 'vue';
  import VueRouter from 'vue-router';
4df4ea19   jingsam   optimize project ...
6
  import App from './app.vue';
7fa943eb   梁灏   init
7
8
9
10
11
12
13
14
15
16
17
18
  
  Vue.use(VueRouter);
  
  // 开启debug模式
  Vue.config.debug = true;
  
  // 路由配置
  var router = new VueRouter({
      history: true
  });
  
  router.map({
b8273bfc   jingsam   add a nav for tes...
19
      '/button': {
7fa943eb   梁灏   init
20
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
21
              require(['./routers/button.vue'], resolve);
7fa943eb   梁灏   init
22
23
          }
      },
b8273bfc   jingsam   add a nav for tes...
24
      '/card': {
7fa943eb   梁灏   init
25
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
26
              require(['./routers/card.vue'], resolve);
7fa943eb   梁灏   init
27
28
          }
      },
b8273bfc   jingsam   add a nav for tes...
29
      '/message': {
7fa943eb   梁灏   init
30
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
31
              require(['./routers/message.vue'], resolve);
7fa943eb   梁灏   init
32
33
34
35
36
37
38
          }
      },
      '/more': {
          component: function (resolve) {
              require(['./routers/more.vue'], resolve);
          }
      },
b8273bfc   jingsam   add a nav for tes...
39
      '/page': {
7fa943eb   梁灏   init
40
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
41
              require(['./routers/page.vue'], resolve);
7fa943eb   梁灏   init
42
43
          }
      },
b8273bfc   jingsam   add a nav for tes...
44
      '/poptip': {
7fa943eb   梁灏   init
45
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
46
              require(['./routers/poptip.vue'], resolve);
7fa943eb   梁灏   init
47
          }
7c15ac9e   梁灏   add Message compo...
48
      },
b8273bfc   jingsam   add a nav for tes...
49
      '/radio': {
7c15ac9e   梁灏   add Message compo...
50
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
51
              require(['./routers/radio.vue'], resolve);
7c15ac9e   梁灏   add Message compo...
52
          }
40f8606f   梁灏   add Notice component
53
      },
b8273bfc   jingsam   add a nav for tes...
54
      '/select': {
40f8606f   梁灏   add Notice component
55
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
56
              require(['./routers/select.vue'], resolve);
40f8606f   梁灏   add Notice component
57
          }
4ec205b6   梁灏   add Tag UI
58
      },
b8273bfc   jingsam   add a nav for tes...
59
      '/slider': {
4ec205b6   梁灏   add Tag UI
60
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
61
              require(['./routers/slider.vue'], resolve);
4ec205b6   梁灏   add Tag UI
62
          }
e355dd49   梁灏   add Select Component
63
      },
b8273bfc   jingsam   add a nav for tes...
64
      '/step': {
e355dd49   梁灏   add Select Component
65
          component: function (resolve) {
b8273bfc   jingsam   add a nav for tes...
66
              require(['./routers/step.vue'], resolve);
e355dd49   梁灏   add Select Component
67
          }
7fa943eb   梁灏   init
68
69
70
71
72
73
74
75
76
77
78
79
      }
  });
  
  router.beforeEach(function () {
      window.scrollTo(0, 0);
  });
  
  router.afterEach(function (transition) {
  
  });
  
  router.redirect({
b8273bfc   jingsam   add a nav for tes...
80
      '*': "/button"
7fa943eb   梁灏   init
81
  });
4df4ea19   jingsam   optimize project ...
82
  router.start(App, '#app');