我正在使用zk框架进行实习。我目前有一个控制器,可以从api获取特殊链接,并且必须在zul文件中创建IFrame并将此链接绑定到此iframe。
我不知道如何动态绑定来自对象,模式文件或属性文件的数据。
<div v-for="predefinedContentItem in getPredefinedContentCategoryItems(category.id)"
:class="['category-item-content-wrapper', { 'not-clickable': isMainDialogClosed}]"
v-tooltip.right="getPredefinedContentItemMessage(predefinedContentItem)"
slot="content"
:key="predefinedContentItem.id"
@click="onPredefinedContentItemClick(predefinedContentItem, category.id)">
zk是否像其他前端框架中那样类似于src =“ {mylink}”?是否可以在zk框架中动态绑定数据?
答案 0 :(得分:1)
是的,有可能。我建议使用MVVM绑定。
zul文件:
<window viewModel="@id('vm') @init('com.example.IndexVM')">
<div id="iframe-div" height="100%" style="background: #ccc;">
<iframe id="iframe" width="100%" height="100%" src="@load(vm.includeSrc)" />
</div>
</window>
视图模型:
public class IndexVM() {
public String getIncludeSrc() {
return "https://thisIsTheLink.com";
}
}