diff options
Diffstat (limited to 'src/App.vue')
| -rw-r--r-- | src/App.vue | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/App.vue b/src/App.vue index 5c7c293..b1efd4b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,15 @@ <script> import tol from './tol.json'; +function addTileCounts(tree){ + if (tree.children && tree.children.length > 0){ + tree.children.forEach(addTileCounts) + tree.tileCount = tree.children.reduce((acc, val) => acc + val.tileCount, 0); + } else { + tree.tileCount = 1; + } +} +addTileCounts(tol); + import TileTree from "./components/TileTree.vue"; export default { data() { |
