我有一個刀片匿名組件。
我想將一個屬性作為物件傳遞給組件。
當我這樣做時,物件轉換為字串
該組件檔案:@props(['object'/span>])
{{ $object }}}。
組件的呼叫:
<x-component object="物件變數" />
uj5u.com熱心網友回復:
像這樣嘗試,在屬性名稱前加一個:。例子:
welcome.blade.php
。@php
$customer = (object)['name' => 'Kenny'] 。
@endphp
<x-customer-component :customer="$customer"/span>/>
^
customer-component.blade.php
<div>
<p>Hey, my name is {{ $customer->name }}</p>
</div>/span>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/331788.html
標籤:
上一篇:如何保留編輯過的影像的EXIF?
下一篇:無法從json物件中獲取特定資料
