<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
</head>
<body>
<div id="app">
<p>{{myStr}}</p>
<button @click="myFunction()">Click Me</button>
</div>
<script>
new Vue({
el: '#app',
data: {
myObj:{"firstName":"John", "lastName":"Doe"},
myStr:''
},
methods:{
myFunction: function () {
this.myStr = JSON.stringify(this.myObj);
}
});
</script>
</body>
</html>
Copyrights@tutorialsplane.com