Wrapper component not working
See original GitHub issueHi, I’m trying to create a wrapper component as mentioned in #18 in order to get around the limitation of not being able to define a default prefix
value, but it is not working. Here it is:
<template functional>
<font-awesome-icon
:icon="['far', icon]"
></font-awesome-icon>
</template>
<script>
import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
export default {
components: {
FontAwesomeIcon
},
props: {
icon: {
type: String,
default: ''
}
},
}
</script>
It builds fine, but I am getting this error in console:
[Vue warn]: Unknown custom element: <font-awesome-icon> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in <Anonymous>)
I am registering my wrapper in my main app.js
file like this:
// Font Awesome
import {library} from '@fortawesome/fontawesome-svg-core'
import {far} from '@fortawesome/pro-regular-svg-icons';
library.add(far);
Vue.component('fa-icon', require('./components/FontAwesome'));
What am I doing wrong?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React wrapper component not working as expected
One issue I have with this is I want to use the useDropzone hook in both the Wrapper component and the MyDropzone component....
Read more >[Bug][v6]: Could not use wrapper component around Route ...
I just ran into this problem as well. I'm seeing something even stranger where any component with a path and element property is...
Read more >React wrapper component not working as expected-Reactjs
[Solved]-React wrapper component not working as expected-Reactjs. Search. score:1. function Wrapper({ children }) { const { getRootProps, getInputProps, ...
Read more >How To Create Wrapper Components in React with Props
In this tutorial, you'll create wrapper components with props using the React JavaScript library. Wrapper components are components that ...
Read more >Why Is styled-components "styled" Wrapper Not Working With ...
Fix for styled-components not applying styling to extended React component.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah I see… so this works now:
app.js
./components/FontAwesome.vue
I don’t like having to register the component twice, but if that’s what I gotta do to override the default prefix then I guess it’ll have to stay.
Thanks.
Try
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'