Last active
October 8, 2020 02:59
-
-
Save petrusnog/8cf20c434f66bafa965d24d40c6de7da to your computer and use it in GitHub Desktop.
Exemplo de módulo que chama Vue Components.
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
| var carrinho = (function () { | |
| Vue.component('carrinho-item', { | |
| props: ['thumbnail', 'preco'], | |
| template: ` | |
| <li class="carrinho-item"> | |
| <figure class="carrinho-thumb"> | |
| <img :src="thumbnail"> | |
| </figure> | |
| <a class="carrinho-title" href="#"><slot></slot></a> | |
| <span class="preco">{{ '$' + preco }}</span> | |
| </li> | |
| ` | |
| }); | |
| Vue.component('Carrinho', { | |
| template: ` | |
| <div class="carrinho navbar-dropdown"> | |
| <div class="carrinho-content"> | |
| <ul class="carrinho-items"> | |
| <slot></slot> | |
| </ul> | |
| <button class="button is-success is-light carrinho-checkout">Finalizar compra</button> | |
| </div> | |
| </div> | |
| ` | |
| }); | |
| }); | |
| export default carrinho; |
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 Carrinho from './carrinho.js'; | |
| Carrinho(); //Chama os componentes descritos no arquivo acima. | |
| new Vue({ | |
| el: "#root" | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment