| 26 | for (const layout of addedLayouts) { |
| 27 | layouts[layout] = defineComponent({ |
| 28 | setup (_, ctx) { |
| 29 | const route = useRoute() |
| 30 | watch(() => route.path, () => routeChanges++, { immediate: true }) |
| 31 | const fixed = route.path |
| 32 | |
| 33 | const key = `[layout] ${layout}` |
| 34 | setups[key] ??= 0 |
| 35 | setups[key]++ |
| 36 | |
| 37 | return () => { |
| 38 | renders[key] ??= 0 |
| 39 | renders[key]++ |
| 40 | |
| 41 | // console.log([ |
| 42 | // `'${layout}' layout`, |
| 43 | // 'Current route: ' + route.path + ` (initialised at: ${fixed})`, |
| 44 | // ]) |
| 45 | |
| 46 | return h('div', {}, [ |
| 47 | h('h1', `'${layout}' layout`), |
| 48 | h('h2', 'Current route: ' + route.path + ` (initialised at: ${fixed})`), |
| 49 | ...ctx.slots.default?.() || [], |
| 50 | ]) |
| 51 | } |
| 52 | }, |
| 53 | }) |
| 54 | } |
| 55 | for (const page of addedPages) { |