php - PHP Laravel Trix 所见即所得如何显示数据库中的内容
问题描述
我使用 laravel 6.0 并且对 Trix 所见即所得有问题。如何获得 trix 编辑器的价值。问题不在于如何将它传递给我使用 trix 的视图,问题在于如何显示它 - 例如这里我通过“值”获取内容(标题):
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
推荐阅读
- html - 来自 HTML 文档中嵌入的 typeform 的“unsafe-eval”错误 Google App Engine 托管
- python - 如何格式化我的 y 轴以在 Seaborn 图表中显示逗号分隔符?
- c# - 创建一个新的 .txt 文件,而不是在 C# 中追加
- angular - 使用 Docker 在 nginx 服务器上部署 Angular 应用程序 欢迎使用 nginx
- ios - maxKeyCount 和 addPositiveDiagnosisKeys 如何交互?
- javascript - 对象过滤器功能在我的代码中向后工作
- amazon-web-services - 为什么我无法从 Delphi VCL 应用程序读取和写入 Amazon S3?
- python - 在 GPU 而不是 Ubuntu 上的 CPU 上运行 Spyder 代码
- amazon-web-services - AWS IAM 是否支持允许 AWS 组织内的所有账户的策略?
- c++ - 函数指针 Arduino 作为回调 Bluefruit 库