我是 ZK 的新手。我创建了一个包含 vlayout 组件的 zul 文件。这是完整的代码:
<?page title="My Chart"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul
http://www.zkoss.org/2005/zul/zul.xsd">
<vlayout apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('util.charts.LineChartVM')" >
<chart id="chart" title="Half-Year Report" width="520" height="350" paneColor="#FFFFFF"
type="line" yAxis="Amount"
model="@bind(vm.model)" engine="@bind(vm.engine)" threeD="@bind(vm.threeD)"
/>
<hlayout visible="@bind(not empty vm.message)">
You clicked on :<label value="@bind(vm.message)"/>
</hlayout>
</vlayout>
</zk>
此外,我在 pom 文件中添加了以下代码段:
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zul</artifactId>
<version>3.6.3</version>
</dependency>
但是,当我运行该文件时,出现以下错误:
org.zkoss.zk.ui.metainfo.DefinitionNotFoundException: Component definition not found: vlayout in [LanguageDefinition: xul/html],...
我的 zul 版本似乎不支持 vlayout。有谁知道这个问题的可能解决方案?有没有人有过类似的经历?
提前致谢!
最佳答案
问题是你的pom中zk的版本。
Vlayout从 5.0.4 开始可用,但您使用的是 3.6.3
我想最好是使用 6.5.0,这是最新的 zk。
但是您至少需要 6.0,因为您正在使用数据绑定(bind)。
关于exception - ZK 中的 vlayout 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13955970/