LayoutComponent
<template>
//some code here ...
<div>
<slot></slot>
</div>
</template>
In composition api you can pass a a layout by importing it and passing it into the layout option of defineComponent
<script lang="ts">
import {defineComponent} from 'vue'
import LayoutComponent from '@/path/to/component'
☝️
export default defineComponent({
layout: LayoutComponent
//... ☝️
What would be the equivalent of this in a setup script? Thank you in advance :)
<script setup lang="ts">
import LayoutComponent from '@/path/to/component
// ???
I realized that you can wrap the entire component with the layout component.
<script setup lang="ts">
import LayoutComponet form '@/path/to/component'
</script>
<template>
<LayoutComponent>
<p>Component wrapped in a layout</p>
</LayoutComponent>
</template>
I don't delete this question in case someone finds this useful :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With