v-for / r-for
import { type FC, ref } from '@rue-js/rue';
const meta = {
framework: 'Rue',
renderer: 'Vapor',
syntax: 'TSX directives',
};
const VForAndRFor: FC = () => {
const fruits = ref([
{ id: 1, name: 'Apple' },
{ id: 2, name: 'Banana' },
{ id: 3, name: 'Cherry' },
]);
const count = ref(3);
return (
<div className="grid gap-4">
<ul className="list bg-base-100 rounded-box">
<li v-for="(item, index) in fruits.value" className="list-row">
{index + 1}. {item.name}
</li>
</ul>
<div className="flex flex-wrap gap-2">
<span r-for="(value, key) in meta" className="badge badge-outline">
{key}: {value}
</span>
</div>
<div className="flex flex-wrap gap-2">
<span v-for="step in count.value" className="badge badge-primary">
Step {step}
</span>
</div>
</div>
);
};
export default VForAndRFor;