错误 “Avoided redundant navigation to current location...” 的解决方案

当 vue 项目中使用 vue-router 的 编程式导航 写法进行路由切换时:

// Search/index.vue
<button @click="goSearch" v-model="keyword">搜索</button>  //按钮绑定事件,切换路由

methods: {
    goSearch() {
      this.$router.push({     //编程式导航
        name: 'search',
        params: {
          keyword: this.keyword,
        },
        query: {
          k: this.keyword.toUpperCase()
        }
      })
    }
  }

如果用户在页面 多次点击按钮 时,浏览器的控制台报如下错误:

错误原因: vue-router 实例上的 push 方法返回的是 promise 对象,所以传入的参数期望有一个成功和失败的回调,如果省略不写则会报错。

解决方案一:每次使用 push 方法时带上两个回调函数:

this.$router.push(`/search/${this.keyword}}`, ()=>{}, ()=>{})  
//第二、第三个参数分别为成功和失败的回调函数
      

解决方案二:重写 Vue-router 原型对象上的 push 函数:

let originPush =  VueRouter.prototype.push;  //备份原push方法

VueRouter.prototype.push = function (location, resolve, reject){
    if (resolve && reject) {    //如果传了回调函数,直接使用
        originPush.call(this, location, resolve, reject);
    }else {                     //如果没有传回调函数,手动添加
        originPush.call(this, location, ()=>{}, ()=>{}); 
    }
}

  • 12
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
This book is concerned with results in graph theory in which linear algebra and matrix theory play an important role. Although it is generally accepted that linear algebra can be an important component in the study of graphs, traditionally, graph theorists have remained by and large less than enthusiastic about using linear algebra. The results discussed here are usually treated under algebraic graph theory, as outlined in the classic books by Biggs [20] and by Godsil and Royle [39]. Our emphasis on matrix techniques is even greater than what is found in these and perhaps the subject matter discussed here might be termed linear algebraic graph theory to highlight this aspect. After recalling some matrix preliminaries in the Chap. 1, the next few chapters outline the basic properties of some matrices associated with a graph. This is followed by topics in graph theory such as regular graphs and algebraic connectivity. Distance matrix of a tree and its generalized version for arbitrary graphs, the resistance matrix, are treated in the next two chapters. The final chapters treat other topics such as the Laplacian eigenvalues of threshold graphs, the positive definite completion problem, and matrix games based on a graph. We have kept the treatment at a fairly elementary level and resisted the temptation of presenting up-to-date research work. Thus, several chapters in this book may be viewed as an invitation to a vast area of vigorous current research. Only a beginning is made here with the hope that it will entice the reader to explore further. In the same vein, we often do not present the results in their full generality, but present only a simpler version that captures the elegance of the result. Weighted graphs are avoided, although most results presented here have weighted, and hence more general, analogs. The references for each chapter are listed at the end of the chapter. In addition, a master bibliography is included. In a short note at the end of each chapter, we indicate the primary references that we used. Often, we have given a different treatment, as well as different proofs, of the results cited. We do not go into an elaborate description of such differences.
Instructions for Hades™ Video Wall Processor Chapter 1 Instructions for Safe Using 1.1 Power Supply Please use single-phase three-wire AC 220V power with protection, and please ensure that the entire engineering systems are grounded, such power as not grounded should not be used. The grounding pin of the power cable should not be damaged. 1.2 Power Off If it is necessary to move the equipment or carrying other workings that need to cut off the power, the power should be turned off to ensure the safety of the equipment. 1.3 Cable Placing articles on the power, signal or communication cables are prohibited. Stepping on or compressing the cable should be avoided, so as to avoid the dangerous situation such as power leakage or short circuit etc. The equipment only can be started for operation after ensure that the signal and communication cables etc have been connected. 1.4 Radiation The surface holes on the equipment for radiation should not be blocked, so as to prevent heat accumulation which will result in damages to the equipment. 1.5 Environment The operation environment of the equipment should be dust-proof, moisture proof and liquid immersion proof. 1.6 Maintenance All the maintenance work should be carried out and completed by professional staff. Without permission, private maintenance is not allowed to avoid that electric shock occurs. 1.7 Installation of the Equipment The equipment should be installed on the stable, steady and even working table or in the standard stand, cabinet and chassis. 1.8 Safety Notes 1.8.1 The high voltage exists in the equipment, non-professional staff is not allowed to open the equipment, so as to avoid that danger occurs. 1.8.2 That place such container as is filled in with liquid on or near the equipment is prohibited. 1.8.3 That the equipment is close to fire is prohibited. 1.8.4 Sufficient ventilation should be ensured. A space of 20CM should be maintained and kept between the front and back panel of the equipment. 1.8.5 The power plug should be unplugged in case of that thunder and lightning occurs or it is not being used for a long time. 1.8.6 In order to avoid that damages will be caused to the equipment, the vents of the equipment should not be blocked. 1.8.7Do not place the equipment on the place near liquid. 1.8.8 Please place the power cable properly to avoid damages.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值