bimalshah72
3 years ago
18
2
Vue

Vue router history option True

Posted 3 years ago by bimalshah72

Hello,

while using Vue router with history = false, and if I load url - "providers/home#!/providers/list" it is working fine with me. But if I keep history on, and try to load above url, it automatically switches to "providers/home" and giving me loading of my not_found_component.

here is my code ...

// modules/providers/app.js

// Telling Vue to use the router
Vue.use(VueRouter)

// Initializing the router with options
var router = new VueRouter({
  history: true
});


// Redirect certain routes to other routes
router.redirect({
  '/': '/providers/list',
  
})

// Define your routes here.  
// NOTE: You'd normally do something
// like require('./home/index.vue') for the component
router.map({
  // Not found handler
  '*': {
    component: not_found_component
  },
  '/providers': { 
    component: providers_index,

    subRoutes: {
      '/list': {
        component: providers_list,
      },
     
      '/:id/details': {
        component: provider_details,
        subRoutes: {
          '/demographics': {
              component: provider_demographics,
            },
          '/schedule': {
            component: provider_schedule
          }
        }
      }
    }
  },
  
});

// Declaring the app itself
var App = Vue.extend({
  
      
});

// Initializing the whole thing together
router.start(App, '#app')

Please help me

Please sign in or create an account to participate in this conversation.