我正在顯示有關項目列表的信息,這些項目可以選擇包含縮略圖。如果不存在縮略圖,則顯示鏈接以允許上載圖像。DART在迭代模板中繪製畫布列表
我的問題是:在畫布上需要繪製什麼是最好的方法? (見下文)。我需要觸發代碼調用,然後還要識別每個畫布,以便獲取適當的圖像。
我知道它的調用都是通過在代碼中創建元素來完成的,但是我想盡可能使用webui模板機制。
<template iterate="i in gItems.order">
<template if="preItemDisplay(i) == true">
<template if="gItemShowThumb == true">
<div template if="gItems.map[i].thumb == null">
<span class="clickable" on-click="uploadItemImageClick(i)">
Add image...
</span>
</div>
<canvas template if="gItems.map[i].thumb != null" width="80px" height="60px">
</canvas> <!-- ? How to draw on this canvas? -->
</template>
</template>
</template>
是一個自定義元素中的代碼? –
你對賽斯的答案滿意嗎?如果是這樣,你不介意批准嗎? –