: null
}
- // props from route configration
+ // props from route configuration
const routePropsOption = matchedRoute.props[props.name]
const routeProps = routePropsOption
? routePropsOption === true
import { LocationQuery, LocationQueryRaw } from '../query'
import { PathParserOptions } from '../matcher'
-import { Ref, ComputedRef, Component, ComponentPublicInstance } from 'vue'
+import { Ref, ComputedRef, ComponentPublicInstance, Component } from 'vue'
import { RouteRecord, RouteRecordNormalized } from '../matcher/types'
import { HistoryState } from '../history/common'
import { NavigationFailure } from '../errors'
NavigationGuardNext,
RouteLocationNormalized,
} from './index'
-import { createApp, defineComponent } from 'vue'
+import { createApp, defineComponent, h } from 'vue'
const component = defineComponent({})
+const WithProps = defineComponent({
+ props: {
+ id: {
+ type: String,
+ required: true,
+ },
+ },
+})
+
+const Foo = defineComponent({
+ props: {
+ test: String,
+ },
+ setup() {
+ return {
+ title: 'homepage',
+ }
+ },
+ render() {
+ return h('div', `${this.title}: ${this.test}`)
+ },
+})
+
const router = createRouter({
history: createWebHistory(),
- routes: [{ path: '/', component }],
+ routes: [
+ { path: '/', component },
+ { path: '/foo', component: Foo },
+ { path: '/', component: WithProps },
+ ],
parseQuery: search => ({}),
stringifyQuery: query => '',
strict: true,