Vue.Js Convert string to Array
home
Run
screen_rotation
fullscreen
cloud_download
<!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>String = {{ str }}</p> <p>Array = {{result}}</p> <button @click="myFunction()">Click Me</button> </div> <script> new Vue({ el: '#app', data: { str:"Hello World! Welcome Greenland.", result:'' }, methods:{ myFunction: function () { this.result = this.str.split(" "); // split at blank space } } }); </script> </body> </html>
<!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>String = {{ str }}</p> <p>Array = {{result}}</p> <button @click="myFunction()">Click Me</button> </div> <script> new Vue({ el: '#app', data: { str:"Hello World! Welcome Greenland.", result:'' }, methods:{ myFunction: function () { this.result = this.str.split(" "); // split at blank space } } }); </script> </body> </html>
Copyrights@tutorialsplane.com