laravelvue.jsvuejs3inertiajs

Using layout property in <script setup> tag


Is there any way to use layout property of inertiajs for vue 3 in <script setup> tag?

In other words, I am asking for an equivalent of the following code,

<script>
import from "../Shared/Layout";

export default {
   layout: Layout;
};
</script>

when the tag is the vue 3 <script setup>

Thank you


Solution

  • <script setup> doesn't support setting a component's layout. And Inertia doesn't provide an API to do that from <script setup>.

    You could still declare a <script> block for that option alongside <script setup>:

    <script>
    import from "../Shared/Layout";
    
    export default {
       layout: Layout;
    };
    </script>
    
    <script setup>
    ⋮
    </script>