Romentigo
4 months ago
2316
3
Laravel

Loading spinner in blade

Posted 4 months ago by Romentigo

I have layout "app.blade.php" and, for example, view "user.blade.php" with Vue components inside. I've got it how to display Vue component loading, but don't know how to do the same with Laravel views.

Yes, I know that it not works as Vue and I always get a rendered view from server. I suppose that I should insert in "app.blade" a view, for example "loading.blade", and when my view "user.blade" with parent Vue component are ready, switch views. Or it's possible to do other way?

When I use loading spinner in Vue parent component, my "user.blade" looks empty and only after a few seconds shows spinner after Vue loaded. But I need to show spinner before Vue is loaded.

My "user.blade":

@extends('layouts.app')

@section('pageTitle', 'Особистий кабінет')

@section('content')
    <div id="app">
        <manage></manage>
    </div>
    <script src="{{ asset('/js/app.js') }}"></script>
@endsection

RenderController:

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class RenderController extends Controller
{
    public function welcome()
    {
        return view('welcome');
    }

    public function user()
    {
        return view('user');
    }
}

Please sign in or create an account to participate in this conversation.