你能用 Stencil 中的 v-for 类比一下吗? (类似于 Stencil 中的 v-for)
Can you give analogy with v-for in Stencil ? (something like v-for in Stencil)
我应该复制元素的一部分几次,这取决于 Stencil 中的数组。我在 Vue 中使用了 v-for,但我可以在 Stencil 中使用什么?
根据 docs:
Loops can be created in JSX using either traditional loops when creating JSX trees, or using array operators such as map when inlined in existing JSX.
所以
render() {
return (
<div>
{this.items.map((item) =>
<div>
<div>{item.name}</div>
</div>
)}
</div>
)
}
应该大约相当于
<div v-for="item in items">
<div>{{ item.name }}</div>
...
我应该复制元素的一部分几次,这取决于 Stencil 中的数组。我在 Vue 中使用了 v-for,但我可以在 Stencil 中使用什么?
根据 docs:
Loops can be created in JSX using either traditional loops when creating JSX trees, or using array operators such as map when inlined in existing JSX.
所以
render() {
return (
<div>
{this.items.map((item) =>
<div>
<div>{item.name}</div>
</div>
)}
</div>
)
}
应该大约相当于
<div v-for="item in items">
<div>{{ item.name }}</div>
...