Read Variables in DWC?
-
I'm curious if anyone has figured out how to read the new global variables directly into DWC's source code?
-
@oozebot Global variables are part of the object model so you can map them from the machine/model state as well. Something like this should work in DWC:
<template> ... {{ myVar }} ... </template> <script> ... computed: mapState('machine/model', { myVar: state => state.global.myVar }), ... </script>
-
@chrishamm thanks! I literally just figured it out, but the way I did it is slightly different.. same results so I guess there is no issue with this?
myVar: state => state.machine.model.global.myVar,
-
@oozebot Yes, I think that mapping should work as well.