Skip to content

Commit c4f08e4

Browse files
committed
Merge branch 'feat-1.3.0' of https://github.com/vueComponent/ant-design-vue into feat-1.3.0
2 parents 754d897 + 13b78b9 commit c4f08e4

File tree

18 files changed

+769
-0
lines changed

18 files changed

+769
-0
lines changed
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`renders ./components/comment/demo/basic.md correctly 1`] = `
4+
<div class="ant-comment">
5+
<div class="ant-comment-inner">
6+
<div class="ant-comment-avatar"><span class="ant-avatar ant-avatar-circle ant-avatar-image"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="Han Solo"></span></div>
7+
<div class="ant-comment-content">
8+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name"><a>Han Solo</a></span><span class="ant-comment-content-author-time"><span class="">a few seconds ago</span></span></div>
9+
<div class="ant-comment-content-detail">
10+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.</p>
11+
</div>
12+
<ul class="ant-comment-actions">
13+
<li><span><i class="anticon anticon-like"><svg viewBox="64 64 896 896" data-icon="like" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"></path></svg></i> <span style="cursor: 'auto';">
14+
0
15+
</span></span></li>
16+
<li> </li>
17+
<li><span><i class="anticon anticon-dislike"><svg viewBox="64 64 896 896" data-icon="dislike" width="1em" height="1em" fill="currentColor" aria-hidden="true" class=""><path d="M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"></path></svg></i> <span style="cursor: 'auto';">
18+
0
19+
</span></span></li>
20+
<li> </li>
21+
<li><span>Reply to</span></li>
22+
</ul>
23+
</div>
24+
</div>
25+
</div>
26+
`;
27+
28+
exports[`renders ./components/comment/demo/editor.md correctly 1`] = `
29+
<div>
30+
<!---->
31+
<div class="ant-comment">
32+
<div class="ant-comment-inner">
33+
<div class="ant-comment-avatar"><span class="ant-avatar ant-avatar-circle ant-avatar-image"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="Han Solo"></span></div>
34+
<div class="ant-comment-content">
35+
<div class="ant-comment-content-author"></div>
36+
<div class="ant-comment-content-detail">
37+
<div>
38+
<div class="ant-row ant-form-item">
39+
<div class="ant-form-item-control-wrapper">
40+
<div class="ant-form-item-control"><span class="ant-form-item-children"><textarea value="" rows="4" class="ant-input"></textarea></span>
41+
<!---->
42+
</div>
43+
</div>
44+
</div>
45+
<div class="ant-row ant-form-item">
46+
<div class="ant-form-item-control-wrapper">
47+
<div class="ant-form-item-control"><span class="ant-form-item-children"><button type="submit" class="ant-btn ant-btn-primary"><span>Add Comment</span></button></span>
48+
<!---->
49+
</div>
50+
</div>
51+
</div>
52+
</div>
53+
</div>
54+
</div>
55+
</div>
56+
</div>
57+
</div>
58+
`;
59+
60+
exports[`renders ./components/comment/demo/list.md correctly 1`] = `
61+
<div class="comment-list ant-list ant-list-split">
62+
<div class="ant-list-header">2 replies</div>
63+
<div class="ant-spin-nested-loading">
64+
<div class="ant-spin-container">
65+
<div class="ant-list-item">
66+
<div class="ant-list-item-content ant-list-item-content-single">
67+
<div class="ant-comment">
68+
<div class="ant-comment-inner">
69+
<div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"></div>
70+
<div class="ant-comment-content">
71+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span></div>
72+
<div class="ant-comment-content-detail">
73+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.</p>
74+
</div>
75+
<ul class="ant-comment-actions">
76+
<li><span>Reply to</span></li>
77+
</ul>
78+
</div>
79+
</div>
80+
</div>
81+
</div>
82+
</div>
83+
<div class="ant-list-item">
84+
<div class="ant-list-item-content ant-list-item-content-single">
85+
<div class="ant-comment">
86+
<div class="ant-comment-inner">
87+
<div class="ant-comment-avatar"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"></div>
88+
<div class="ant-comment-content">
89+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name">Han Solo</span></div>
90+
<div class="ant-comment-content-detail">
91+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.</p>
92+
</div>
93+
<ul class="ant-comment-actions">
94+
<li><span>Reply to</span></li>
95+
</ul>
96+
</div>
97+
</div>
98+
</div>
99+
</div>
100+
</div>
101+
</div>
102+
</div>
103+
</div>
104+
`;
105+
106+
exports[`renders ./components/comment/demo/nested.md correctly 1`] = `
107+
<div class="ant-comment">
108+
<div class="ant-comment-inner">
109+
<div class="ant-comment-avatar"><span class="ant-avatar ant-avatar-circle ant-avatar-image"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="Han Solo"></span></div>
110+
<div class="ant-comment-content">
111+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name"><a>Han Solo</a></span></div>
112+
<div class="ant-comment-content-detail">
113+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
114+
</div>
115+
<ul class="ant-comment-actions">
116+
<li><span>Reply to</span></li>
117+
</ul>
118+
</div>
119+
</div>
120+
<div class="ant-comment-nested">
121+
<div class="ant-comment">
122+
<div class="ant-comment-inner">
123+
<div class="ant-comment-avatar"><span class="ant-avatar ant-avatar-circle ant-avatar-image"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="Han Solo"></span></div>
124+
<div class="ant-comment-content">
125+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name"><a>Han Solo</a></span></div>
126+
<div class="ant-comment-content-detail">
127+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
128+
</div>
129+
<ul class="ant-comment-actions">
130+
<li><span>Reply to</span></li>
131+
</ul>
132+
</div>
133+
</div>
134+
<div class="ant-comment-nested">
135+
<div class="ant-comment">
136+
<div class="ant-comment-inner">
137+
<div class="ant-comment-avatar"><span class="ant-avatar ant-avatar-circle ant-avatar-image"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="Han Solo"></span></div>
138+
<div class="ant-comment-content">
139+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name"><a>Han Solo</a></span></div>
140+
<div class="ant-comment-content-detail">
141+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
142+
</div>
143+
<ul class="ant-comment-actions">
144+
<li><span>Reply to</span></li>
145+
</ul>
146+
</div>
147+
</div>
148+
</div>
149+
<div class="ant-comment">
150+
<div class="ant-comment-inner">
151+
<div class="ant-comment-avatar"><span class="ant-avatar ant-avatar-circle ant-avatar-image"><img src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="Han Solo"></span></div>
152+
<div class="ant-comment-content">
153+
<div class="ant-comment-content-author"><span class="ant-comment-content-author-name"><a>Han Solo</a></span></div>
154+
<div class="ant-comment-content-detail">
155+
<p>We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure).</p>
156+
</div>
157+
<ul class="ant-comment-actions">
158+
<li><span>Reply to</span></li>
159+
</ul>
160+
</div>
161+
</div>
162+
</div>
163+
</div>
164+
</div>
165+
</div>
166+
</div>
167+
`;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import demoTest from '../../../tests/shared/demoTest'
2+
3+
demoTest('comment')

components/comment/demo/basic.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<cn>
2+
#### 基本评论
3+
一个基本的评论组件,带有作者、头像、时间和操作。
4+
</cn>
5+
6+
<us>
7+
#### Basic comment
8+
A basic comment with author, avatar, time and actions.
9+
</us>
10+
11+
```html
12+
<template>
13+
<a-comment>
14+
<template slot="actions">
15+
<span>
16+
<a-tooltip title="Like">
17+
<a-icon
18+
type="like"
19+
:theme="action === 'liked' ? 'filled' : 'outlined'"
20+
@click="like"
21+
/>
22+
</a-tooltip>
23+
<span style="paddingLeft: '8px';cursor: 'auto'">
24+
{{likes}}
25+
</span>
26+
</span>
27+
<span>
28+
<a-tooltip title="Dislike">
29+
<a-icon
30+
type="dislike"
31+
:theme="action === 'disliked' ? 'filled' : 'outlined'"
32+
@click="dislike"
33+
/>
34+
</a-tooltip>
35+
<span style="paddingLeft: '8px';cursor: 'auto'">
36+
{{dislikes}}
37+
</span>
38+
</span>
39+
<span>Reply to</span>
40+
</template>
41+
<a slot="author">Han Solo</a>
42+
<a-avatar
43+
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
44+
alt="Han Solo"
45+
slot="avatar"
46+
/>
47+
<p slot="content">We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.</p>
48+
<a-tooltip slot="datetime" :title="moment().format('YYYY-MM-DD HH:mm:ss')">
49+
<span>{{moment().fromNow()}}</span>
50+
</a-tooltip>
51+
</a-comment>
52+
</template>
53+
<script>
54+
import moment from 'moment'
55+
export default {
56+
data () {
57+
return {
58+
likes: 0,
59+
dislikes: 0,
60+
action: null,
61+
moment,
62+
}
63+
},
64+
methods: {
65+
like() {
66+
this.likes = 1
67+
this.dislikes = 0
68+
this.action = 'liked'
69+
},
70+
dislike() {
71+
this.likes = 0
72+
this.dislikes = 1
73+
this.action = 'disliked'
74+
}
75+
}
76+
}
77+
</script>
78+
```

components/comment/demo/editor.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<cn>
2+
#### 回复框
3+
评论编辑器组件提供了相同样式的封装以支持自定义评论编辑器。
4+
</cn>
5+
6+
<us>
7+
#### Reply Editor
8+
Comment can be used as editor, user can customize the editor component.
9+
</us>
10+
11+
```html
12+
<template>
13+
<div>
14+
<a-list
15+
v-if="comments.length"
16+
:dataSource="comments"
17+
:header="`${comments.length} ${comments.length > 1 ? 'replies' : 'reply'}`"
18+
itemLayout="horizontal"
19+
>
20+
<a-list-item slot="renderItem" slot-scope="item, index">
21+
<a-comment
22+
:author="item.author"
23+
:avatar="item.avatar"
24+
:content="item.content"
25+
:datetime="item.datetime"
26+
>
27+
</a-comment>
28+
</a-list-item>
29+
</a-list>
30+
<a-comment>
31+
<a-avatar
32+
slot="avatar"
33+
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
34+
alt="Han Solo"
35+
/>
36+
<div slot="content">
37+
<a-form-item>
38+
<a-textarea rows=4 @change="handleChange" :value="value" ></a-textarea>
39+
</a-form-item>
40+
<a-form-item>
41+
<a-button
42+
htmlType="submit"
43+
:loading="submitting"
44+
@click="handleSubmit"
45+
type="primary"
46+
>
47+
Add Comment
48+
</a-button>
49+
</a-form-item>
50+
</div>
51+
</a-comment>
52+
</div>
53+
</template>
54+
<script>
55+
import moment from 'moment'
56+
export default {
57+
data () {
58+
return {
59+
comments: [],
60+
submitting: false,
61+
value: '',
62+
moment,
63+
}
64+
},
65+
methods: {
66+
handleSubmit() {
67+
if (!this.value) {
68+
return;
69+
}
70+
71+
this.submitting = true
72+
73+
setTimeout(() => {
74+
this.submitting = false
75+
this.comments = [
76+
{
77+
author: 'Han Solo',
78+
avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
79+
content: this.value,
80+
datetime: moment().fromNow(),
81+
},
82+
...this.comments,
83+
]
84+
this.value = ''
85+
}, 1000)
86+
},
87+
handleChange(e) {
88+
this.value = e.target.value
89+
}
90+
},
91+
}
92+
</script>
93+
```

components/comment/demo/index.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<script>
2+
import Basic from './basic'
3+
import Editor from './editor'
4+
import List from './list'
5+
import Nested from './nested'
6+
import CN from '../index.zh-CN.md'
7+
import US from '../index.en-US.md'
8+
9+
const md = {
10+
cn: `# Comment评论
11+
对网站内容的反馈、评价和讨论。
12+
13+
## 何时使用
14+
15+
评论组件可用于对事物的讨论,例如页面、博客文章、问题等等。`,
16+
us: `# Comment
17+
A comment displays user feedback and discussion to website content.
18+
19+
## When To Use
20+
21+
Comments can be used to enable discussions on an entity such as a page, blog post, issue or other.`,
22+
}
23+
export default {
24+
category: 'Components',
25+
type: 'Data Display',
26+
zhType: '数据展示',
27+
title: 'Comment',
28+
subtitle: '评论',
29+
cols: 1,
30+
render () {
31+
return (
32+
<div>
33+
<md cn={md.cn} us={md.us}/>
34+
<Basic/>
35+
<br/>
36+
<List/>
37+
<br/>
38+
<Nested/>
39+
<br/>
40+
<Editor/>
41+
<br/>
42+
<api>
43+
<template slot='cn'>
44+
<CN/>
45+
</template>
46+
<US/>
47+
</api>
48+
</div>
49+
)
50+
},
51+
}
52+
</script>

0 commit comments

Comments
 (0)