@collinped could you please go more into depth? I tried your approach but I still get the:
"Unresolved function or method asset() "
import './bootstrap';
import '../css/app.css';
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';
import Vapor from 'laravel-vapor'
const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';
Vapor.withBaseAssetUrl(import.meta.env.VITE_VAPOR_ASSET_URL)
window.Vapor = Vapor
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
.use(plugin)
.use(ZiggyVue, Ziggy)
.mixin({
methods: { asset: window.Vapor.asset }
})
.mount(el);
},
});
InertiaProgress.init({ color: '#4B5563' });
And the component
<template>
<div>
<Head title="Create Participant" />
<h1 class="mb-8 text-3xl font-bold mt-2">
<Link class="text-indigo-400 hover:text-indigo-600" href="/admin/particiapnts">Participants </Link>
<span class="text-indigo-400 font-medium">/</span> Create
</h1>
<div class="max-w-3xl bg-white rounded-md shadow overflow-hidden">
<form @submit.prevent="store">
<img :src="asset('img/image.png') />
<div class="flex flex-wrap flex-col -mb-8 -mr-6 p-8">
<text-input v-model="form.name" :error="form.errors.name" class="pb-8 pr-6 w-full lg:w-1/2" label="Participant name" />
<text-input v-model="form.bio" :error="form.errors.bio" class="pb-8 pr-6 w-full lg:w-1/2" label="Participant bio" />
</div>
<div class="flex items-center justify-end px-8 py-4 bg-gray-50 border-t border-gray-100">
<loading-button :loading="form.processing" class="btn-indigo" type="submit">Create Contact</loading-button>
</div>
</form>
</div>
</div>
</template>
<script>
import { Head, Link } from '@inertiajs/inertia-vue3'
import Layout from '@/Layouts/SuperAdminLayout.vue';
import LoadingButton from '@/Shared/LoadingButton.vue';
import TextInput from "@/Shared/TextInput.vue";
export default {
components: {
Head,
Link,
TextInput,
LoadingButton,
},
layout: Layout,
props: {},
remember: 'form',
data() {
return {
form: this.$inertia.form({
name: '',
bio: '',
}),
}
},
methods: {
store() {
this.form.post('/admin/participants')
},
},
}
</script>