vue-routisan icon indicating copy to clipboard operation
vue-routisan copied to clipboard

[3.1] Route component props

Open mikerockett opened this issue 3 years ago • 0 comments

Vue Router allows route params to be passed as props to the relevant components renders by a RouterView. Routisan should be able to enable this on a per-route basis, or via a global config, or even a grouping mechanism (don't see why we'd want to do it that way, but may as well).

We already have a props utility, however it was never intended for this purpose. The idea there was that you could pass in an object, or call prop multiple times.

That being said, the best approach would likely be to allow passing in true or nothing (ie, undefined) when calling props – both scenarios would yield props: true in the route payload. Any subsequent calls to props or prop would replace this.

At group level, we could pass in a props: true setting to apply props to all children. We could do the same for children groups, however it would be better to manage in a group.

Then, at global level, we could call Factory.paramsAsProps() or perhaps we could introduce a global config helper, Factory.config({ props: true }).

mikerockett avatar May 07 '21 04:05 mikerockett