bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

Laravel7中Blade組件有哪些

這篇文章主要介紹Laravel 7中Blade組件有哪些,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

成都創新互聯公司是一家專注于成都網站設計、成都網站建設與策劃設計,古縣網站建設哪家好?成都創新互聯公司做網站,專注于網站建設10年,網設計領域的專業建站公司;建站業務涵蓋:古縣等地區。古縣做網站價格咨詢:13518219792

表單按鈕

開發一個應用時,如果您希望重定向并且做一些其他操作時,不能使用簡單的鏈接。GET 請求很容易受到 CSRF 攻擊。

相反,您應該使用其他 HTTP 請求方式,使用表單和 CSRF 驗證。 下面是一個在表單中生成按鈕的 FormButton 組件。

{{-- content of formButton.blade.php --}}
<form method="POST" action="{{ $action }}">
    @csrf
    @method($method ?? 'POST')
        <button
            type="submit"
            class="{{ $class ?? '' }}"
        >
            {{ $slot }}
        </button>
</form>

您可以像這樣使用它:

// perform an action
<x-form-button :action="route('doSomething')">
   Do something
</x-form-button>
// perform an action with another HTTP verb
<x-form-button :action="route('model.delete', $model)" method="delete">
   Delete model
</x-form-button>

導航欄

幾乎任何應用程序都需要顯示某種導航,比如菜單和選項卡。這些導航鏈接是動態的,這樣用戶就可以知道自己在應用程序的哪個部分。

下面是可以展示鏈接的 navigationLink 組件。當其以當前請求的 URL 開始時,它會自動將自身設置為活動狀態。

{{-- content of navigationLink.blade.php --}}
<li class="{{ \Illuminate\Support\Str::startsWith(request()->url(), $href) ? 'active' : ''  }}">
    <a href="{{ $href }}" @isset($dataDirtyWarn) data-dirty-warn @endisset>
        {{ $slot }}
    </a>
</li>

這里是如何在 mailcoach.app 中使用它的。

 <nav class="tabs">
        <ul>
            <x-navigation-item :href="route('mailcoach.emailLists.subscribers', $emailList)">
                <x-icon-label icon="fa-users" text="Subscribers" :count="$emailList->subscribers()->count() ?? 0" />
            </x-navigation-item>
            <x-navigation-item :href="route('mailcoach.emailLists.tags', $emailList)">
                <x-icon-label icon="fa-tag" text="Tags" />
            </x-navigation-item>
            <x-navigation-item :href="route('mailcoach.emailLists.segments', $emailList)">
                <x-icon-label icon="fa-chart-pie" text="Segments" />
            </x-navigation-item>
            <x-navigation-item :href="route('mailcoach.emailLists.settings', $emailList)">
                <x-icon-label icon="fa-cog" text="Settings" />
            </x-navigation-item>
        </ul>
    </nav>

這就是渲染的方法。

表單元素

Blade 組件會渲染出自適應的表單元素。我們來看一下 textField 組件在 Mailcoach 中的用法。

<div class="form-row">
    @if($label ?? null)
    <label class="{{ ($required ?? false) ? 'label label-required' : 'label' }}" for="{{ $name }}">
        {{ $label }}
    </label>
    @endif
    @error($name)
        <p class="form-error" role="alert">{{ $message }}</p>
    @enderror
    <input
        autocomplete="off"
        type="{{ $type ?? 'text' }}"
        name="{{ $name }}"
        id="{{ $name }}"
        class="input"
        placeholder="{{ $placeholder ?? '' }}"
        value="{{ old($name, $value ?? '') }}"
        {{ ($required ?? false) ? 'required' : '' }}
    >
</div>

正如你所看到的一樣,它渲染了標簽、表單字段和可能的錯誤。這就是它的用法。

<x-text-field label="Name" name="name" required />

以上是“Laravel 7中Blade組件有哪些”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創新互聯行業資訊頻道!

分享文章:Laravel7中Blade組件有哪些
標題來源:http://vcdvsql.cn/article46/gjoeeg.html

成都網站建設公司_創新互聯,為您提供微信小程序建站公司微信公眾號全網營銷推廣外貿網站建設App開發

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

綿陽服務器托管