vue-router-sitemap
vue-router-sitemap copied to clipboard
applyParams method of VueRouterSitemap uses undefined applyParams function
./src/index.js
:
class VueRouterSitemap {
// ...
applyParams(paramsConfig) {
this.paths = applyParams(this.paths, paramsConfig);
return this;
}
// ...
}
Moreover, applyParams
is not implemented in the project at all. So the issue requests implementation of the function.
Solved it this way:
VueRouterSitemap.prototype.applyParams = function applyParams(params) {
this.paths = this.paths.map(p => ({
path: Object.keys(params).reduce((acc, curr) => {
return acc.replace(curr, params[curr]);
}, p.path)
}));
return this;
};