0

This example is not working, is there any solution or usage is illegal?

Vue.component('hello', {
    template: '<span>Hello world!</span>'
})
Vue.component('foo', {
    data(){
        return {
            say_hello: '<hello></hello>'
        }
    },
    template: '<div v-html="say_hello"></div>'
})

1
  • if you add vueJS dependencies, anyone can see the issue being replicated and can offer help... Commented Nov 7, 2018 at 11:46

1 Answer 1

1

No that's not supported. The content of v-html is not processed by Vue, so no vue components, tags or bindings can be used there.

In general, if you see any markup outside of a template, it's an anti-pattern. And v-html is something you should use rarely and with a bad conscience :-)

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

1 Comment

Don't hesitate to accept the answer if it's useful !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.