Created
January 5, 2025 21:36
-
-
Save gauti123456/3fd90d7137d5c0d91fa50473cbe30245 to your computer and use it in GitHub Desktop.
Vue.js 3 Tutorial to Show Country Flag Icons Using vue-country-flag Library in TypeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| <h2>Vue Country Flag Example</h2> | |
| <!-- Display flags with different sizes --> | |
| <CountryFlag country="us" size="big" /> | |
| <CountryFlag country="fr" size="normal" /> | |
| <CountryFlag country="de" size="small" /> | |
| <!-- You can also use custom properties like rounded, shadow, and background --> | |
| <CountryFlag country="in" size="big" :rounded="true" :shadow="true" /> | |
| </div> | |
| </template> | |
| <script> | |
| export default { | |
| name: 'App' | |
| } | |
| </script> | |
| <style scoped> | |
| /* Add some custom styling if needed */ | |
| div { | |
| text-align: center; | |
| margin-top: 50px; | |
| } | |
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createApp } from 'vue'; | |
| import App from './App.vue'; | |
| import CountryFlag from 'vue-country-flag-next' | |
| const app = createApp(App) | |
| // Registering the component globally | |
| app.component('CountryFlag', CountryFlag) | |
| // Mount the Vue app | |
| app.mount('#app'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment