search

Home  >  Q&A  >  body text

javascript - [vue] Router.go(-1) is used in business logic to implement page rollback. How to refresh or re-request data from the background after rollback?

As the title states, this.$router.go(-1) is used in the business logic to implement rollback, but how to request background data again after rollback?

Currently the logic for requesting background data is written in mounted, but mounted will not trigger when rolling back

  mounted:function(){
     // ajax get 数据
  },
迷茫迷茫2779 days ago930

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-19 10:33:55

    Try adding a timestamp after the request address.

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:33:55

    can clearly tell you that when calling back, any life cycle callback of the target route will be executed, including mounted.
    So you might as well check your code to see if there is any logic problem.

    reply
    0
  • Cancelreply