JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/vue@2.0.0/dist/vue.js"></script>
<div id="example">
<p>{{ name }} は {{ priceWithTax }}円</p>
</div>
JavaScript
var vm = new Vue({
el: '#example', // document.getElementById('example'), $('#example')[0] も可
computed: {
priceWithTax: function() {
return this.price * 1.08;
}
},
data: {
name: 'みかん',
price: 100
}
});
// jsfiddle の環境で Console から vm を参照できるようにするため
window.vm = vm;