为什么在查询的 ID 部分会出现该错误?
没有与此调用匹配的过载。
<template>
<swiper-slide
slot="list"
v-for="(list, index) in list.banner"
:key="index"
><img :src="list.image_url" @click="noticeRead(list.id)"
/></swiper-slide>
</template>
export default class Main extends Vue {
noticeRead(id: number): void {
if (id != null) {
this.$router.push({
path: "/help/notice/read",
query: {
id: id ,
},
});
}
}
}
答案 0 :(得分:0)
当您在 ,
参数中丢失最后一个 $router.push()
时会发生什么?
所以打字稿变成:
export default class Main extends Vue {
noticeRead(id: number): void {
if (id != null) {
this.$router.push({
path: "/help/notice/read",
query: {
id: id
}
})
}
}
}