在 Laravel 7 中,我开始使用View Components。我正在尝试将$attributes
变量从一个组件传递到另一个组件,例如:
x-模态组件:
<div {{ $attributes->merge(['class' => 'modal fade']) }}>
Something great...
</div>
x-modal-form 组件:
<x-modal {{ $attributes }}>
Something great too
</x-modal>
在这种情况下,我在 x-modal 组件中有一个id属性,例如:
<x-modal-form id="aRandomId" title="Test"></x-modal-form>
但在这种情况下,id aRandomId不会传播到 x-modal 组件。由于{{ $attributes }} ,我有一个错误“语法错误,意外'endif'(T_ENDIF),期待文件结束”
你知道怎么做吗?