72、Vue 常用技术
1、路由route
$route属性和$router 路由传递参数 如果是params参数 需要路由占位
//第一种写法 //this.$router.push('/search/'+this.keyword+'?k='+this.keyword.toUpperCase()); //第二种写法 模板字符串 //this.$router.push(`/search/${this.keyword}?k=${this.keyword.toUpperCase()}`); //第三种写法 let location = {name: "search", params: {keyword: this.keyword || undefined}}; if(this.$route.query) { location.query = this.$route.query; } this.$router.push(location);

浙公网安备 33010602011771号