Passing dynamic class into dashboard 2.0 ui_template

Answer:

:title="msg.main?.articlename"

Explanation

  • The : before the attribute tells Vue "there is some dynamic functionality in here, go and compute it"
  • The ? is required because on first load the msg.main will not be equal to anything, so it will be trying to read .articlename of undefined.
  • There is no need for any {}, the : tells Vue it's JavaScript.

Note: I've assumed here yu're sending msg.main and not msg.payload is is more common.

1 Like