Vue路由器+ Vuetify:beforeEach()中的$ vuetify

时间:2018-12-06 12:18:45

标签: vue.js vue-router vuetify.js

是否可以在路由器配置内的beforeEach()中使用$ vuetify.breakpoint?

Vue.use(Router);

const router = new Router({
  mode: MODES.history,
  base: process.env.BASE_URL,
  routes: [path1, path2, something]
});

router.beforeEach((to, from, next) => {
  if ($vuetify.breakpoint.name === 'xs') {
    next({ path: "/something" });
  } else {
    next();
  }
});

export default router;

0 个答案:

没有答案