我试图在livewire & laravel中对文本进行转换
它正在与{{ $html }}
一起工作
<p class="text-gray-600" x-data="{show: false}" x-show.transition.duration.1000ms="show" x-init="setTimeout(() => { show = true })" id="{{ $slide['current']['id'] }}c">{{ '<h1>hi</h1>' }}</p>
但是它不适用于{!! $html !!}}
<p class="text-gray-600" x-data="{show: false}" x-show.transition.duration.1000ms="show" x-init="setTimeout(() => { show = true })" id="{{ $slide['current']['id'] }}c">{!! '<h1>hi</h1>' !!}</p>
发布于 2021-03-05 10:01:30
--您不能将
<h1>
放在<p>
元素中。浏览器会把它移出去。
所以我必须将它添加到<div>
中
<div class="text-gray-600" x-data="{show: false}" x-show.transition.duration.1000ms="show" x-init="setTimeout(() => { show = true })" id="{{ $slide['current']['id'] }}c">{!! '<h1>hi</h1>' !!}</div>
https://stackoverflow.com/questions/66397769
复制相似问题