mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
c1ddb359e3
Co-authored-by: Damian Głowala <damian.glowala.rebkow@gmail.com>
45 lines
787 B
Vue
45 lines
787 B
Vue
<template>
|
|
<div>
|
|
<button
|
|
class="swap-layout"
|
|
@click="swapLayout"
|
|
>
|
|
swap layout
|
|
</button>
|
|
<button
|
|
class="log-foo"
|
|
@click="logFoo"
|
|
>
|
|
log foo
|
|
</button>
|
|
<button
|
|
class="log-hello"
|
|
@click="logHello"
|
|
>
|
|
log hello
|
|
</button>
|
|
<NuxtLayout ref="layout" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const layout = ref()
|
|
const currentLayout = useState('current-layout', () => 'custom')
|
|
|
|
definePageMeta({
|
|
layout: 'custom'
|
|
})
|
|
|
|
function logFoo () {
|
|
layout.value.layoutRef.logFoo()
|
|
}
|
|
function logHello () {
|
|
layout.value.layoutRef.logHello()
|
|
}
|
|
|
|
function swapLayout () {
|
|
currentLayout.value = currentLayout.value === 'custom2' ? 'custom' : 'custom2'
|
|
setPageLayout(currentLayout.value)
|
|
}
|
|
</script>
|