[Vuejs]-How to create a dynamic vue component that has a computed template containing another component with Object properties without passing it as string

1👍

I was able to do what I wanted by using JSON.stringify still but pass the entry as object :entry

wierd.service.js

export default {
   entryToHtml(entry) {
       return `<entry :entry='${JSON.stringify(entry)}'></entry>`;
    }
}

Entry.vue

<template>
    <div>{{entry.name}}</div>
</template>

<script>
  export default { 
      name: 'Entry',
      props: {
          entry: Object
      }
   }
</script>

Leave a comment