mirror of
https://github.com/flarum/core.git
synced 2025-08-05 16:07:34 +02:00
common: add routeName to component props in mapRoutes
This commit is contained in:
@@ -10,14 +10,15 @@ export default function mapRoutes(routes: object, basePath: string = ''): RouteD
|
||||
const map = {};
|
||||
|
||||
for (const key in routes) {
|
||||
if (!routes.hasOwnProperty(key)) continue;
|
||||
|
||||
const route = routes[key];
|
||||
|
||||
if (route.component) {
|
||||
if (!route.component.attrs) route.component.attrs = {};
|
||||
route.component.attrs.routeName = key;
|
||||
}
|
||||
|
||||
map[basePath + route.path] = route.component;
|
||||
map[basePath + route.path] = {
|
||||
render() {
|
||||
return m(route.component, { routeName: key });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return map;
|
||||
|
@@ -316,7 +316,7 @@ export default class IndexPage extends Page {
|
||||
params.sort = sort;
|
||||
}
|
||||
|
||||
m.route(app.route(this.props.routeName, params));
|
||||
m.route.set(app.route(this.props.routeName, params));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user