Skip to content

docs(comment):更新组件状态为100% #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/comment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions packages/devui-vue/devui/comment/src/comment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
font-size: $devui-text;
}
&-actions{
padding: 0;
list-style-type: none;
margin: 12px 0 0;
}
Expand Down
20 changes: 17 additions & 3 deletions packages/devui-vue/devui/comment/src/comment.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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) => <li key={`devui-comment-action-${index}`}>{action}</li>);
const actionList = actions.map((action:any, index:number) => <li key={`devui-comment-action-${index}`} class={`devui-comment-action-${index}`}>{action}</li>);
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?.();
Expand Down