tsi-trevor
tsi-trevor
NNuxt
Created by tsi-trevor on 5/14/2024 in #❓・help
How can I remove a route parameter value?
Say I have a route /foo/:bar? that is distinct (at least by what's rendered on the page) from /foo. How can I clear :bar and cause a redirect? My current attempt looks like this:
/** Currently at /foo/buzz */
const router = useRouter()

/** To be triggered by some event */
const foo = () => router.replace({ params: { bar: null } })
/** Currently at /foo/buzz */
const router = useRouter()

/** To be triggered by some event */
const foo = () => router.replace({ params: { bar: null } })
4 replies