I have two routes with different views but the same view model. How can I specify what view the route should use?
For example, I have route
/user. The both use the same view model because the data is identical. But the presentation (view) should be different.
I’ve tried passing parameters in the route and then setting the view in
getViewStrategy(), but there seems to be no way of getting any info from the
router.currentInstruction in time before
getViewStrategy() is called.
created() is the lifecycle hook where the
router.currentInstruction is updated, but
getViewStrategy() is run before that, so I can’t get any info from the route before it’s too late.
I can’t use the
<compose> without an ugly workaround, which would require some sort of a middle view. So I prefer doing it as non-ugly as possible.
Is there a way to specify the view for a route the same way you can specify the view model?