Vue
by Sergei Sokolov
HTML
<div id="app">
<div class="grid">
<template v-for="(row, i) in arr">
<div class="cell"
v-for="(col, j) in row"
v-if="col"
:style="{gridColumnStart:j+1, gridRowStart:i+1}"
/>
</template>
</div>
</div>
CSS
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
.cell {
height: 50px;
background: #f00;
}
Vue
/**
* для вопроса https://qna.habr.com/q/749737
* Как отрисовать элементы из двумерного массива?
*/
new Vue({
el: "#app",
data: {
arr: [
[0, 1, 0],
[2, 0, 3]
]
}
})