Template node msg.payload

Can I pass msg.payload to ui-template in Dashboard 2?
When the user selects an option from a dropdown I set msg.payload to true. I want to pass this to the template so that the overlay appears. When the data returns I set the payload to false and pass it to template to hide the overlay

The examples I've looked at all involve a control defined within the template

I took the template code from the Vuetify site

<template>
  <div class="text-center">
    
    <v-overlay
      :model-value="overlay"
      class="align-center justify-center"
    >
      <v-progress-circular
        color="primary"
        size="64"
        indeterminate
      ></v-progress-circular>
    </v-overlay>
  </div>
</template>
<script>
  export default {
    data: () => ({
      overlay: false,
    }),

    watch: {
      overlay (val) {
        val && setTimeout(() => {
          this.overlay = false
        }, 3000)
      },
    },
  }
</script>

msg is already available. You can use a watch on msg and you can access it via this.msg.

This is all documented in the online docs: Template ui-template | Node-RED Dashboard 2.0

Yes. Works a treat. As always read the manual!!!!
Thanks for that

1 Like