Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons not working in Vue3 while rendering with v-html #412

Open
mshishkov opened this issue Nov 4, 2022 · 1 comment
Open

Icons not working in Vue3 while rendering with v-html #412

mshishkov opened this issue Nov 4, 2022 · 1 comment

Comments

@mshishkov
Copy link

mshishkov commented Nov 4, 2022

################################ index.hml #######################################
<!DOCTYPE html>
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <div id="app">
            Element not rendered: <span v-html="faElem"></span>
            <br>
            While simple usage is working: <fa icon="fa-solid fa-envelope" />
        </div>
        <script src="js/app.js"></script>
    </body>
</html>
################################ app.js #######################################
import './bootstrap';
import { createApp } from 'vue';

// FontAwesome
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { faEnvelope } from '@fortawesome/free-solid-svg-icons';
library.add(faEnvelope);

createApp({
    data() {
        return {
             faElem: `<fa icon="fa-solid fa-envelope" />`
        }
    }
})
    .component('fa', FontAwesomeIcon)
    .mount('#app');

That's what rendered
image

@mshishkov mshishkov reopened this Nov 5, 2022
@CodelineRed
Copy link

This behaviour is intended by Vue and is not related to FA.
A google search like "v-html with components" could help you to try a different approach.
How to use components in v-html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants