Skip to content

Instantly share code, notes, and snippets.

View thulioph's full-sized avatar
🔥

Thulio Philipe thulioph

🔥
View GitHub Profile
@thulioph
thulioph / MyComponent.test.js
Created March 31, 2017 17:37
Post sobre o Vuejs.
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!');
});
});
@thulioph
thulioph / MyComponent.vue
Created March 31, 2017 17:36
Post sobre o Vuejs.
<template>
<span>{{ message }}</span>
</template>
<script>
export default {
data () {
return {
message: 'Hello!'
}
@thulioph
thulioph / modifiers-2.html
Created March 31, 2017 17:36
Post sobre o Vuejs.
<form @submit.prevent="doSomething"></form>
@thulioph
thulioph / modifiers.html
Last active April 20, 2017 18:50
Post about the Vuejs.
<form id="myForm"></form>
<script>
let myForm = document.getElementById('myForm');
myForm.addEventListener('submit', doSomething, false);
function doSomething(e) {
e.preventDefault();
}
@thulioph
thulioph / v-bind.html
Created March 31, 2017 17:34
Post sobre o Vuejs.
<a
v-bind:href="url"
v-bind:class="myClass">
link
</a>
<a
:href="url"
:class="myClass">
link
@thulioph
thulioph / v-on.html
Last active April 20, 2017 18:11
Post sobre o Vuejs.
<button v-on:click="doSomething">
Click
</button>
<button @click="doSomething">
Click
</button>
@thulioph
thulioph / methods.vue
Last active April 20, 2017 18:16
Post about the Vuejs.
<template>
<button @click="toggle">
Change Status
</button>
<p>{{ active }}</p>
</template>
<script>
export default {
@thulioph
thulioph / props.vue
Created March 31, 2017 17:33
Post sobre o Vuejs.
<template>
<div>
<h4>{{ address }}</h4>
</div>
</template>
<script>
export default {
props: {
address: {
@thulioph
thulioph / component-lifecycle.js
Last active April 20, 2017 17:36
Post sobre o Vuejs.
export default {
created() {
console.warn('When the component was created.');
},
mounted() {
console.warn('When the component was mounted.');
},
updated() {
@thulioph
thulioph / component-data.vue
Created March 31, 2017 17:32
Post sobre o Vuejs.
<template>
<p>{{ isActive }}</p>
</template>
<script>
export default {
data() {
return {
isActive: false
};