answered
2018-06-25 10:23:50 +0800
cor3000 6280 ● 2 ● 7 If you say value="@load(bar)"
it will simply look for a variable in the current available scopes (e.g. component, page, desktop, session, application, spring ...).
According to your explanations you never set such a scoped variable (or added a custom variable resolver - that might resolve variables from component properties). So I'd say everything works as it should. No variable in scope -> no value.
Technically what you'd need based on your descriptions (to access the component property directly) is this:
<window id="_window" width="80%">
<label value="@load(_window.parent.bar)"/>
</window>
You could declare viewModel="@id('someVM')" which is then available as a variable in the component scope below your window component.
But any other scoped attribute would work too, as a separate view model/binder is maybe too expensive depending on how often this component is repeated.
So you could just set a component scoped attribute inside your composite component.
this.setAttribute("bar", "some label value");
(this is equivalent to <custom-attributes bar="some label value"/>)
Here a single zul demonstration of the 2 approaches.
In the end I am still not fully convinces that this will give the expected results, since you weren't very specific. So if this doesn't match at all. I'll be happy to answer more detailed questions.