1

I have view and I want to load svg based on router params, I have installed vue-loader and it is working if I hard code it.

<template>
<div>
  <suit/>
</div>
</template>

<script>
export default {
  components:{

    suit: ()=>import('../assets/svg/'+Param+'.svg')
  }
}
</script>

<style>
</style>

This is what I have. Instead of Param I want to get this.route.params, but when I try this I get undefined which is logical because components wrapper is object. Is there a way to pass a variable here or must I redo the whole thing?

1 Answer 1

1

Instead of this.route.params, within a component you should be using this.$route.params. Vue Router Docs.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.