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
CodePudding user response:
using layout in vue is specific to nuxt. Nuxt provides composition api support with its 3rd version (demo version as of the date of this article). If you want to use layout with script setup, you should switch to nuxt3. If you're not using Nuxt, you can check out the vue-router child routes to create a simple layout logic with vue.
CodePudding user response:
<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>