Vue.Js string endsWith
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"> {{result}} </div> <script> new Vue({ el: '#app', data: { str:"Hello World!", result: '' }, methods:{ checkEndswith: function () { var v = this; var r = v.str.endsWith("World!"); if(r){ v.result = "Ends with - World!"; } } }, mounted () { this.checkEndswith(); } }); </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"> {{result}} </div> <script> new Vue({ el: '#app', data: { str:"Hello World!", result: '' }, methods:{ checkEndswith: function () { var v = this; var r = v.str.endsWith("World!"); if(r){ v.result = "Ends with - World!"; } } }, mounted () { this.checkEndswith(); } }); </script> </body> </html>
Copyrights@tutorialsplane.com