JSFiddle - React, Tailwind, and code Playground

by nkovacs

HTML

<script src="https://rawgit.com/yyx990803/vue/0.11.8/dist/vue.js"></script>
<app-red red ></app-red>

<app-red></app-red>

CSS

div.red {
    background: red;
}

JavaScript

var red = {
    template: '<div v-class="red: red" v-on="click: toggle">Click this to make it red</div>',
    replace: true,
    paramAttributes: ['red'],
    methods: {
        toggle: function () {
            this.red = !this.red;
        }
    },
    compiled: function () {
        if (this.red == undefined) {
            this.red = false;
        } else {
            this.red = true;
        }
    }
}

new Vue({
    el: 'body',
    components: {
        'app-red': red
    }
})