- `mode: 'history'` -> `history: createWebHistory()`
- Catch all routes (`/*`) must now be defined using a parameter with a custom regex: `/:catchAll(.*)`
+#### Improvements
+
+These are technically breaking changes but they fix an inconsistent behavior.
+
+- Pushing or resolving a non existant named route throws an error instead of navigating to `/` and displaying nothing.
+
### Missing features
- `keep-alive` is not yet supported
<template>
<section>
- <div class="long">
+ <div class="long" id="top">
This one is long: {{ route.params.n }}. Go down to click on a link
</div>
<p class="long">
>/long-{{ Number(route.params.n || 0) + 1 }}</router-link
>
</p>
+ <a href="#top">Go to top</a>
</section>
</template>
<script>
-import { defineComponent, inject } from 'vue'
+import { defineComponent } from 'vue'
+import { useRoute } from '../../src'
export default defineComponent({
name: 'LongView',
setup() {
- const route = inject('route')
+ const route = useRoute()
return { route }
},
})