R
R
robert_ford2020-11-07 19:27:55
Vue.js
robert_ford, 2020-11-07 19:27:55

Why can't register the component?

One of the Vue components has text where placeholders (character sequences ### or @@@ ) are replaced with the corresponding component.

computed: {
            processedHtml () {
                let html = this.content.replaceAll('###', '<b-form-input type="text" size="sm" :name="name"></b-form-input>').replaceAll('@@@', '<gap></gap>');
                return {
                    template: '<div>' + html + '</div>'
                }
            }
        }


In the component's template:
<template>
  <component v-bind:is="processedHtml"></component>
</template>


However, there is an error
[Vue warn]: Unknown custom element: gap - did you register the component correctly? ...
found in
--->
at /src/components/Fill.vue
at /src/App.vue If you try to directly render

gap

in the component's template , then everything will work out
<template>
<gap></gap>
</template>

What could be the reason for such behavior?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-11-07
@yarkov Vue.js

This package will save

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question