const route = useRoute()
const router = useRouter()
deep clone route.query and then change the property of new query,it works (url changes)
let newQuery = { ...route.query}
newQuery.keyword = undefined
router.push({
name: 'search',
query: newQuery,
})
but if I change property in route.query and then deep clone changed route.query,it cannot work (url not changes)
route.query.keyword = undefined
let newQuery = { ...route.query}
router.push({
name: 'search',
query: newQuery,
})
use console.log(newQuery) to check two newQuery, they are totally same.
It confuses me. I wonder why that is