//input框
<el-input v-model="kw" placeholder="Please Input" class="input-with-select"
style="width: 420px;" @keyup.enter="getSong(kw)">
//ts
let kw = route.params.kw;
想过通过input绑定另一个参数,来实现本页面的搜索,可以实现,但是地址栏仍然是第一次传过来的参数
希望有人能帮我讲解一下该怎么做
路由参数是死的,你不能修改数据后同步更改路由,你只能才输入框中输入内容然后按回车或者其他操作触发路由更新,把最新输入的值重新传入路由,但是这样会有个问题,就是页面路由更改了,但是页面没有自动刷新
你绑定了kw input change时 就需要 改变kw 。 你给 input加个 @change试试
绑定的kw写死了,这个时候在输入的时候绑定@input="inputChange"方法,并将参数传入kw
//input框
<el-input v-model="kw" placeholder="Please Input" class="input-with-select" style="width: 420px;" @keyup.enter="getSong(kw)" @input="inputChange">
methods:{
inputChange(val){
this.kw = val;
}
}