1👍
It’s done as in any other place in JavaScript:
if (!isSomething.value) {
router.replace('/somepage')
} else {
// rest of setup script with a lot of code
}
That there’s "a lot of code" suggests that view component can be refactored to contain only the code that is essential for a route, the rest of the content can be extracted to nested component.
- [Vuejs]-Print both key and value to the console
- [Vuejs]-Vue.js props not showing actual message value, What have I done and how can I solve it?
Source:stackexchange.com