How to Use declare global variable in Vue JS
Immediately, i we’ll present you find out how to use declare world variable in Vue JS. This text provides you with easy instance of find out how to use declare world variable in Vue JS. you’ll learn to use declare world variable in Vue JS. So let’s comply with few step to create instance of find out how to use declare world variable in Vue JS.
Instance
<!DOCTYPE html> <html> <head> <title>How you can Use declare world variable in Vue JS</title> <script src="https://cdn.jsdelivr.internet/npm/vue"></script> </head> <physique> <div id="app"> <p>Consequence : {{myResult}}</p> <button @click on="clickFunction()">Click on Me</button> </div> <script sort="textual content/javascript"> Vue.mixin({ knowledge: operate() { return { myGlobalVar:'that is my Codeplaners.com' } } }) var app = new Vue({ el: '#app', knowledge: { myResult: '' }, strategies:{ clickFunction: operate () { this.myResult = this.myGlobalVar; } } }) </script> </physique> </html>
Output
Consequence : that is my Codeplaners.com
Komentar
Posting Komentar