lin-xin / vue-toast

A mobile toast plugin for vue2.

Home Page:https://lin-xin.gitee.io/example/#/vue2-toast/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

不支持在拦截器中使用?

FeSeason opened this issue · comments

需要在请求响应拦截器中使用好像不支持?

axios.interceptors.response.use(response => {
  if (response.data.code === 403) {
   Vue.$toast('不支持?')
    router.push('/login')
  }
  return response.data || {};
}, error => {
  return Promise.resolve(error.response)
})

实例化一下或者直接 Vue.prototype.$toast('不支持?')

axios里面得先Vue.use,然后使用Vue.$toast的方式去使用

拦截器里这样使用 Vue.prototype.$toast('哈哈哈');