script src https vuejs org js vue min js script div id app div script type module new Vue template div hello div el app script let script document createElement script script src https vuejs org js vue min js document body appendChild script let div document createElement div document body appendChild div div id app onload function new Vue template div hello div el app end onload let script document createElement script script src https vuejs org js vue min js document body appendChild script div id sg1 p m1 p div let div document createElement div document body appendChild div div id sg1 let p document createElement p div appendChild p p innerHTML m1 onload function new Vue el sg1 define data initial display text data m1 You got to let me know end onload script document body style height 150pt script script src https vuejs org js vue min js script div id app h2 Todos h2 ol li v for todo in todos label input type checkbox v on change toggle todo v bind checked todo done del v if todo done todo text del span v else todo text span label li ol div script type module new Vue el app data todos text Learn JavaScript done false text Learn Vue done false text Play around in JSFiddle done true text Build something awesome done true methods toggle function todo todo done todo done script script document body style height 100pt script script src https vuejs org js vue min js script div id sg1 p m1 p p button v on click staygo btext button p div script type module some test data var action Go Stay var result It will be double There will be trouble when life is settled load up the fun stuff document addEventListener DOMContentLoaded function new Vue el sg1 define data initial display text and set the text on the button data m1 You got to let me know btext action 0 define the methods alternate between the two values methods staygo function var sel this btext action 0 sel 1 sel 0 this m1 result sel this btext action sel script
v else todo text span label li ol div script type module new Vue el app data todos text Learn JavaScript done false text Learn Vue done false text Play around in JSFiddle done true text Build something awesome done true methods toggle function todo todo done todo done script script document body style height 100pt script script src https vuejs org js vue min js script div id sg1 p m1 p p button v on click staygo btext button p div script type module some test data var action Go Stay var result It will be double There will be trouble when life is settled load up the fun stuff document addEventListener DOMContentLoaded function new Vue el sg1 define data initial display text and set the text on the button data m1 You got to let me know btext action 0 define the methods alternate between the two values methods staygo function var sel this btext action 0 sel 1 sel 0 this m1 result sel this btext action sel script