[Vuejs]-URL prefix to process.env

0👍

With VueRouter
you can set a path like:

const routes = [
  { path: '/companya', name: 'companya', component: MyPage },
  { path: '/companyb', name: 'companyb', component: MyPage },
];

then in MyPage.vue you can look at the current route:

created () {
    switch (this.$route.name) {
      case 'companyA':
        // switch connection
        break;
      case 'companyB':
        // switch connection
        break;
    }
  },

Leave a comment