Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
php server side rendering
// FeatureItem.vue
<template>
<div v-bind:style="{ color: textColor }" v-on:click="toggleColor">
<h2>{{ feature.name }}</h2>
<p>{{ feature.description }}</p>
</div>
</template>
<script>
import {PropType} from 'vue'
export default {
props: ['feature'],
data() {
return {textColor: 'black'}
},
methods: {
toggleColor() {
if (this.$data.textColor == 'black') {
this.$data.textColor = 'green'
} else {
this.$data.textColor = 'black'
}
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment