Last active
June 16, 2020 20:11
-
-
Save KenoLeon/e27042d210fbf6eb96b8a564d877d6d5 to your computer and use it in GitHub Desktop.
Simple props in Vue
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
| <!-- FILE: App.vue --> | |
| <!-- NOTE: Import bootstrap on main.js --> | |
| <template> | |
| <div id="app"> | |
| <bootsAlert v-bind="{ dangerD: dangerData, warnignD: warningData }"/> | |
| </div> | |
| </template> | |
| <script> | |
| import bootsAlert from './components/bootsAlert.vue' | |
| export default { | |
| name: 'App', | |
| components: { | |
| bootsAlert | |
| }, | |
| data() { | |
| return { | |
| dangerData: 'Alert Alert Alert', | |
| warningData: 'Very Important Warning' | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| #app { | |
| font-family: Avenir, Helvetica, Arial, sans-serif; | |
| -webkit-font-smoothing: antialiased; | |
| -moz-osx-font-smoothing: grayscale; | |
| text-align: center; | |
| color: #2c3e50; | |
| margin-top: 60px; | |
| } | |
| </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
| <!-- FILE: components/bootsAlert.vue --> | |
| <template> | |
| <div> | |
| <div class="alert alert-danger" role="alert" style="margin:auto;width:600px;"> | |
| {{dangerD}} | |
| </div> | |
| <br> | |
| <div class="alert alert-warning" role="alert" style="margin:auto;width:600px;"> | |
| {{warnignD}} | |
| </div> | |
| </div> | |
| </template> | |
| <script> | |
| export default { | |
| props: ['dangerD','warnignD'], | |
| name: 'bootsAlert' | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment