I want to use the uibuilder node to make a page that get data from user. This data contains a name .
The ui should take that name and send it to the flow to check if it is not repeated in the database and returns to the ui with true or false.
I recieve the true or false message and save it in msgRecvd and use it later in increment function in methods.
The problem is that it is not readable inside increment function.
I've done this scenario before and it works . but in this project I've been trying for 2 days and I can't see what is wrong
If someone could help, I'd be grateful
This is my javascript for the page:
/*globals Vue, uibuilder */
// @ts-nocheck
/*
Copyright (c) 2019 Julian Knight (Totally Information)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
'use strict'
/** @see https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/Front-End-Library---available-properties-and-methods */
// eslint-disable-next-line no-unused-vars
var app1 = new Vue({
el: '#app',
data: {
startMsg : 'Vue has started, waiting for messages',
msgRecvd: [],
}, // --- End of data --- //
computed: {
}, // --- End of computed --- //
methods: {
increment: function() {
var name= document.getElementById("name").value;
var msgRecvd, datacorrect , namec ;
uibuilder.send( {
'topic': "checkDB",
'payload': {
'name': name
} });
namec = this.msgRecvd
console.log(this.msgRecvd)
uibuilder.send( {
'topic':'test',
'payload': this.msgRecvd,
})
}, // --- End of methods --- //
// Available hooks: init,mounted,updated,destroyed
mounted: function(){
uibuilder.start()
var vueApp = this
vueApp.feVersion = uibuilder.get('version')
uibuilder.onChange('msg', function(newVal){
vueApp.msgRecvd = newVal.payload
})
}
} // --- End of mounted hook --- //
}) // --- End of app1 --- //
// EOF
type or paste code here