评论表单
CommentForm评论正式文章由 CommentSection 提供上下文,表单提交到评论接口;这里复用同一表单与编辑器,以本地样例显示校验和提交结果,不读取作者资料,也不会上传图片或保存评论。
本地演示,评论不会保存,也不会上传图片。
正在加载编辑器…
本地演示,内容不会保存
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
post_id | i32 | 由调用方提供 | 所属文章 ID,由评论区传入。 |
parent_id | Option<i64> | 必填(可传 None) | None 发表顶层评论;Some(id) 回复指定评论。 |
parent_indent | Option<i32> | 必填(可传 None) | 回复时抵消父评论缩进的像素值。 |
用法
src/components/comments/form.rs// \u4F4D\u4E8E CommentSection \u63D0\u4F9B\u7684 CommentContext \u4E2D
view! {
<CommentForm post_id=post_id parent_id=None parent_indent=None/>
}