Skip to content

Commit

Permalink
Improve button handling - add ID and show event object
Browse files Browse the repository at this point in the history
  • Loading branch information
TotallyInformation committed Nov 21, 2019
1 parent 22aa02d commit 1e90e7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nodes/templates/vue/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h2>Simple input using Vue</h2>
<b-form-checkbox v-model="inputChkBox">
To tick or not to tick? That is the question
</b-form-checkbox><br>
<b-button pill variant="primary" v-on:click="increment">Increment</b-button>
<b-button id="btn_increment" pill variant="primary" v-on:click="increment">Increment</b-button>
&nbsp;&nbsp;Click Counter: <b>{{counterBtn}}</b>.
<p>Click on the button to increment the counter. It sends the data dynamically back to Node-RED as well.</p>
</p>
Expand Down
5 changes: 4 additions & 1 deletion nodes/templates/vue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ var app1 = new Vue({
},
}, // --- End of computed --- //
methods: {
increment: function() {
increment: function(event) {
console.log('Button Pressed. Event DatA: ', event)

// Increment the count by one
this.counterBtn = this.counterBtn + 1
var topic = this.msgRecvd.topic || 'uibuilder/vue'
Expand All @@ -80,6 +82,7 @@ var app1 = new Vue({
'inputChkBox': this.inputChkBox
}
} )

}, // --- End of increment --- //

// return formatted HTML version of JSON object
Expand Down

0 comments on commit 1e90e7a

Please sign in to comment.