我正在使用 Laravel 9 并試圖了解這些組件。
我有這個“匿名”組件(摘錄):
<option value="{{ $phase->id }}" @if(isset($phase_id) && $phase_id===$phase->id) selected @endif>
{{ $phase->name }}
</option>
該組件是這樣呼叫的:
<x-select-phase id="phase_id" name="phase_id" :phase_id="$event->phase_id"
我期望 var$phase_id存在于組件內部。事實并非如此,不明白為什么。我嘗試了很多事情都沒有成功。接下來我可以嘗試什么?
uj5u.com熱心網友回復:
https://laravel.com/docs/9.x/blade#casing
組件建構式引數應使用
camelCase, whilekebab-case在 HTML 屬性中參考引數名稱時使用。
這表示:
:phase-id="$event->phase_id"
應該生成一個變數:
$phaseId
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/485548.html
標籤:拉拉维尔
