I have a laravel blade page with the @foreach, how can I transfer blade code to .vue page?
I need to transfer @foreach loop to .vue view.
code .vue:
<script setup>
import Welcome from '@/Components/Welcome.vue';
import AppLayout from '@/Layouts/AppLayout.vue';
import { Link } from '@inertiajs/vue3';
defineProps({ staff: Array })
</script>
<template>
<AppLayout title="Staff">
<template #header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Staff
</h2>
</template>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<div class="p-6 text-gray-900 dark:text-gray-100">
@foreach ($staff as $appl_to_staff)
<p>surname: {{ $appl_to_staff.surname}} </p>
<p>name: {{ $appl_to_staff.name}} </p>
<p>patronymic: {{ $appl_to_staff.patronymic}} </p>
<p>dob: {{ $appl_to_staff.dob}}</p>
<p><Link class="font-bold text-blue-600" href="{{ route('staff.show', $appl_to_staff->id) }}">{{ __('Подробнее..') }}</Link></p>
<br>
@endforeach
</div>
</div>
</div>
</div>
</AppLayout>
</template>
code blade:
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Заявки на сотрудников') }}
</h2>
</x-slot>
@if (Session::has('success'))
<div class="bg-lime-500 light:bg-lime-500 overflow-hidden shadow-sm sm:rounded-lg text-black text-center font-semibold">
{{ Session::get('success') }}
</div>
@endif
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900 dark:text-gray-100">
@foreach ($staff as $appl_to_staff)
<p>Фамилия: {{ $appl_to_staff->surname}} </p>
<p>Имя: {{ $appl_to_staff->name}} </p>
<p>Отчество: {{ $appl_to_staff->patronymic}} </p>
<p>Дата рождения: {{ $appl_to_staff->dob}}</p>
<p><a class="font-bold" href="{{ route('staff.show', $appl_to_staff->id) }}">{{ __('Подробнее..') }}<a></p>
<br>
@endforeach
</div>
</div>
</div>
</div>
</x-app-layout>
if u need to see code another file message me. Thank u!
Replace the foreach with Vue v-for
<div v-for="appl_to_staff in staff">
<p>surname: {{ appl_to_staff.surname}} </p>
<p>name: {{ appl_to_staff.name}} </p>
<p>patronymic: {{ appl_to_staff.patronymic}} </p>
<p>dob: {{ appl_to_staff.dob}}</p>
<p>
<Link class="font-bold text-blue-600" href="{{ route('staff.show', appl_to_staff->id) }}">
{{ __('Подробнее..') }}
</Link>
</p>
<br>
</div>
Please or to participate in this conversation.