From 99e18d835da6a12aed0cbf54cad6305c661ba87b Mon Sep 17 00:00:00 2001 From: lishiyao Date: Sat, 18 Dec 2021 13:12:31 +0800 Subject: [PATCH] =?UTF-8?q?docs(comment):=E6=9B=B4=E6=96=B0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=8A=B6=E6=80=81=E4=B8=BA100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/devui-vue/devui/comment/index.ts | 2 +- .../devui-vue/devui/comment/src/comment.scss | 1 + .../devui-vue/devui/comment/src/comment.tsx | 20 ++++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/devui-vue/devui/comment/index.ts b/packages/devui-vue/devui/comment/index.ts index d9fb1203f0..c55970c9e5 100644 --- a/packages/devui-vue/devui/comment/index.ts +++ b/packages/devui-vue/devui/comment/index.ts @@ -10,7 +10,7 @@ export { Comment } export default { title: 'Comment 评论', category: '数据展示', - status: '70%', // TODO: 组件若开发完成则填入"已完成",并删除该注释 + status: '100%', install(app: App): void { app.use(Comment as any) } diff --git a/packages/devui-vue/devui/comment/src/comment.scss b/packages/devui-vue/devui/comment/src/comment.scss index fb2752bd93..967d4b0b90 100644 --- a/packages/devui-vue/devui/comment/src/comment.scss +++ b/packages/devui-vue/devui/comment/src/comment.scss @@ -25,6 +25,7 @@ font-size: $devui-text; } &-actions{ + padding: 0; list-style-type: none; margin: 12px 0 0; } diff --git a/packages/devui-vue/devui/comment/src/comment.tsx b/packages/devui-vue/devui/comment/src/comment.tsx index aeec79fefd..438063c82d 100644 --- a/packages/devui-vue/devui/comment/src/comment.tsx +++ b/packages/devui-vue/devui/comment/src/comment.tsx @@ -1,7 +1,20 @@ import { defineComponent } from 'vue' import { commentProps, CommentProps } from './comment-types' import './comment.scss' - +/* + * date:2021-12-18 + * author:njl + * + * actions 底部操作栏 + * author 作者区域 + * avatar 头像区域 + * content 内容操作区域 + * datetime 时间区域 + * avatarDom 头像可只传入地址 + * actionDom 操作区域根据传入的组件数量来生成相应的li标签 + * + * 目前可成为参数的为 avatar,actions 其他均为具名插槽的形式,后期可继续根据需要改造 +**/ export default defineComponent({ name: 'DComment', props: commentProps, @@ -10,14 +23,15 @@ export default defineComponent({ setup(props, { slots }) { return () => { const getAction = (actions:any) => { + if (!actions || !actions.length) { return null; } - const actionList = actions.map((action:any, index:number) =>
  • {action}
  • ); + const actionList = actions.map((action:any, index:number) =>
  • {action}
  • ); return actionList; }; - const actions = props.actions ?? slots.actions?.(); + const actions = props.actions ?? slots.actions?.(); const author = props.author ?? slots.author?.(); const avatar = props.avatar ?? slots.avatar?.(); const content = props.content ?? slots.content?.();