JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.2/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.1/axios.min.js"></script>
<div id="app">
<test-item></test-item>
</div>
JavaScript
Vue.component('test-item', {
template: '<input type="button" value="test" @click="testMethod">',
data: function() {
return {
test: { name: 'foo', surname: 'test', test:{a:'var'}, test2 :["1", "2"] }
}
},
methods: {
testMethod: function() {
console.log(this.test);
axios.post('/echo/json/', this.test);
}
}
});
new Vue({
el: '#app'
});