1.綁定雙擊事件用 @dblclick 不要用@ondblclick 在vue中@=on
2.Vue中路由跳轉踩坑。
比如我的路由如下定義
routes: [ { path: "/", name: "index", component: Index }, { path: "/gallery", name: "gallery", component: Gallery, children: [ { path: "top/:top/skip/:skip", name: "gallerys", component: Gallery, children: [ { path: "query/:query", name: "search", component: Gallery } ] } ] } ]
然后這么調用“search”這個路由,這個路由里面的參數是動態的,如果“this.searhkey”這個值為空,也可以這么說,只要params里面有一個值為空,都無法定位到“search”路由,會自動跳轉到根路由“Index”
this.$router.push({ name: "search", params: {top: "5", skip: "0", query: this.searhkey } });
3.Vue 路由報錯,如: missing param for named route "mysearchpackage": Expected "query" to be defined,這句話的意思是,在使用“mysearchpackage”的時候,沒有給“query”這個參數賦值,全局搜索“mysearchpackage”這個路由,查看是否在使用該路由的時候少給參數“query”賦值