alexjoverm / v-runtime-template

Vue component for compiling templates on the fly using a v-html like API
MIT License
605 stars 72 forks source link

The "PromoBox" component has been registered but not used #58

Open angi- opened 5 years ago

angi- commented 5 years ago

I have the following issue:

<template>
  <div>
    <v-runtime-template :template="html"></v-runtime-template>
  </div>
</template>

<script>
import VRuntimeTemplate from 'v-runtime-template'
import PromoBox from '@/components/base/promo-box'

export default {
  data () {
    return {
      html: '<div><promo-box></promo-box></div>'
    }
  },
  components: {
    VRuntimeTemplate,
    PromoBox
  }
}
</script>

This throws out error The "PromoBox" component has been registered but not used when building because <promo-box> component is not present in the template. Am I doing something wrong? I see no other people having this issue, am I missing something?

sstenn commented 5 years ago

Any updates on this? I have the same problem.

mikesteeghs commented 4 years ago

This is expected behaviour, because the promo-box component is rendered on runtime. If this message is coming from es-lint, you can disable it for your promo-box component with "eslint-disable-line"

Update this in your file:

components: {
  VRuntimeTemplate,
  PromoBox // eslint-disable-line
}
sstenn commented 4 years ago

Another solution is to register the PromoBox component global

import PromoBox from '@/components/base/promo-box'

Vue.component('PromoBox', PromoBox)