vue-router参数query改变但是url连接参数不改变

vue yekong 1808℃

试了很多方法都不好使,最后想到一个每次路由变化都给一个随机字符串变量就可以了

gourl() {
      var newQuery = {};
      newQuery['pageNum'] = this.orderdata.pageNum
      newQuery['pageSize'] = this.orderdata.pageSize
      newQuery['type'] = this.orderdata.type
      newQuery['order'] = this.orderdata.order
      newQuery['industryId'] = this.orderdata.industryId
      newQuery['active'] = this.orderdata.active
      var str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
      var n = 5, s = "";
      for (var i = 0; i < n; i++) {
        var rand = Math.floor(Math.random() * str.length);
        s += str.charAt(rand);
      }
      console.log(s);
      newQuery[s] = s;
      this.$router.push({path: '/task/hall', query: newQuery});
    },

喜欢 (0)