[Vuejs]-Vue computed property in router template

1👍

There are 2 issues:

1) There’s an error:

Cannot use <template> as component root element because it may contain multiple nodes.

So change that to a div. When using the Vue CLI, templates are wrapped in <template> but there still needs to be a different root element inside of it.

2) The Level component has a prop called message but it isn’t passed. The Home route passes id but not message. Home can’t pass message at the moment, because it’s in the root component, and Home didn’t receive it.

You could:

  • Use Vuex to solve this most cleanly
  • Define message in Home instead of the root and pass it to Level
  • Pass the message from root to Home and then again from Home to Level
👤Dan

Leave a comment