我使用的是laravel 6.0,但在使用Trix wysiwyg时遇到了问题。如何获取值到Trix编辑器。问题不在于如何将其传递到视图,在这里我使用Trix,问题在于如何显示它--例如,我在这里通过 "value "来获取内容(标题),但如何在Trix中传递$article->title,以便有机会编辑它。
Title: </br><input type="text" id='title' name='title' value="{{$article->title}}"></br>
但如何在Trix中显示$article->title,以便有机会编辑它?)
@trix(\App\Article::class, 'title')
只要把一个值放到trix的隐藏输入中就可以了。
<input id="short_desc" type="hidden" name="product_short_description" value="{{ $product->product_short_description ?? "" }}" >
<trix-editor input="short_desc" placeholder="Product short description"></trix-editor