我正在创建一个表,其行包含在 Livewire 组件内
\n<div class="card">\n <div class="card-body">\n <table class="table table-hover table-striped">\n <thead>\n <tr>\n <th>Nombre del Riesgo</th>\n <th>Informaci\xc3\xb3n</th>\n <th>Due\xc3\xb1o del Riesgo</th>\n <th>Costo Adicional</th>\n <th>Prevenci\xc3\xb3n</th>\n </tr>\n </thead>\n <tbody>\n <div>\n @foreach($risks as $risk)\n <livewire:risk-row :risk="$risk"/>\n @endforeach\n </div>\n </tbody>\n </table>\n </div>\n</div>\nRun Code Online (Sandbox Code Playgroud)\n但在行组件中,每当我更改输入或从下拉选择中选择某些内容时,该组件都不会重新渲染。
\n我想知道为什么会发生这种情况。所以我打开控制台并看到:
\nLivewire: Multiple root elements detected. This is not supported. See docs for more information https://laravel-livewire.com/docs/2.x/troubleshooting#root-element-issues <div wire:id=\xe2\x80\x8b"6CNMP1hiBR3Qy7IbmfbQ">\xe2\x80\x8b \xe2\x80\x8b</div>\xe2\x80\x8b\nvalue @ index.js:85\nComponent @ index.js:27\n(anonymous) @ index.js:88\nvalue @ index.js:87\n(anonymous) @ schedule:432\nRun Code Online (Sandbox Code Playgroud)\n这是组件刀片文件
\nLivewire: Multiple root elements detected. This …Run Code Online (Sandbox Code Playgroud)