screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <body> <div id="app"> <h2>Vue js JSON.stringify() </h2> <p>Convert JSON Object into String in Vue Js</p> <button @click="myFunction">click me</button> <p>String:{{testString}}</p> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return{ testObj:{firstName: 'Andrew',lastName:'Roy',role:'developer'}, testString:'' } }, methods:{ myFunction(){ this.testString = JSON.stringify(this.testObj); }, } }).mount('#app') </script> </body> </head> </html>