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 Vue from 'vue'; | |
| import MyComponent from '@/MyComponent.vue'; | |
| describe('MyComponent Spec', () => { | |
| it('Sets the correct default data', () => { | |
| const cpData = MyComponent.data(); | |
| expect(cpData.message).toBe('Hello!'); | |
| }); | |
| }); |
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> | |
| <span>{{ message }}</span> | |
| </template> | |
| <script> | |
| export default { | |
| data () { | |
| return { | |
| message: 'Hello!' | |
| } |
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
| <form @submit.prevent="doSomething"></form> |
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
| <form id="myForm"></form> | |
| <script> | |
| let myForm = document.getElementById('myForm'); | |
| myForm.addEventListener('submit', doSomething, false); | |
| function doSomething(e) { | |
| e.preventDefault(); | |
| } |
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
| <a | |
| v-bind:href="url" | |
| v-bind:class="myClass"> | |
| link | |
| </a> | |
| <a | |
| :href="url" | |
| :class="myClass"> | |
| link |
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
| <button v-on:click="doSomething"> | |
| Click | |
| </button> | |
| <button @click="doSomething"> | |
| Click | |
| </button> |
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> | |
| <button @click="toggle"> | |
| Change Status | |
| </button> | |
| <p>{{ active }}</p> | |
| </template> | |
| <script> | |
| export default { |
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> | |
| <h4>{{ address }}</h4> | |
| </div> | |
| </template> | |
| <script> | |
| export default { | |
| props: { | |
| address: { |
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
| export default { | |
| created() { | |
| console.warn('When the component was created.'); | |
| }, | |
| mounted() { | |
| console.warn('When the component was mounted.'); | |
| }, | |
| updated() { |
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> | |
| <p>{{ isActive }}</p> | |
| </template> | |
| <script> | |
| export default { | |
| data() { | |
| return { | |
| isActive: false | |
| }; |