1
- # new
1
+ # ChatUI
2
2
3
- > A Vue.js project
3
+ ![ image ] ( https://github.com/stuffish/ChatUI/blob/master/preview/preview.gif )
4
4
5
- ## Build Setup
5
+ # Build Setup
6
6
7
7
``` bash
8
8
# install dependencies
@@ -11,11 +11,111 @@ npm install
11
11
# serve with hot reload at localhost:8080
12
12
npm run dev
13
13
14
- # build for production with minification
15
- npm run build
14
+ ```
16
15
17
- # build for production and view the bundle analyzer report
18
- npm run build --report
16
+ # Code Organization
17
+ ```
18
+ ├── build
19
+ ├── config
20
+ ├── preview // project preview image
21
+ ├── src // the source files
22
+ │ ├── assets // static image resource
23
+ │ ├── components
24
+ │ │ ├── chat_area.vue // provide chatting view
25
+ │ │ ├── chat_cell.vue // a cell include contact simple data
26
+ │ │ ├── chat_dialog.vue // pop dialog
27
+ │ │ ├── chat_group.vue // chat-cell group
28
+ │ │ ├── chat_header.vue // top header
29
+ │ │ └── chat_pop_bubble.vue // small bubble clickable
30
+ │ ├── pages
31
+ │ │ ├── chat.vue // chat-each-other view
32
+ │ │ ├── index.vue // contact list
33
+ │ │ ├── overview.vue // contact profile view
34
+ │ │ ├── page_transition.vue // page transition animate
35
+ │ │ ├── pay.vue // pay for VIP
36
+ │ │ └── theme.vue // change theme
37
+ │ ├── router
38
+ │ │ └── index.js // vue router setting
39
+ │ ├── scripts // scripts resource
40
+ │ ├── styles // css resource
41
+ │ ├── App.vue // page entry file
42
+ │ └── main.js // program entry file, load components
43
+ ├── .babelrc
44
+ ├── .gitigore
45
+ ├── data.json // analog data of back end
46
+ ├── index.html // entry html
47
+ ├── LICENSE
48
+ ├── package-lock.json
49
+ ├── package.json
50
+ └── README.md
19
51
```
20
52
21
- For a detailed explanation on how things work, check out the [ guide] ( http://vuejs-templates.github.io/webpack/ ) and [ docs for vue-loader] ( http://vuejs.github.io/vue-loader ) .
53
+ # Components
54
+ ## ChatArea
55
+
56
+ > Provide the conversation view and the message sender of each chatting.
57
+ > ### Menu props
58
+ > | props | Introductions | type | default |
59
+ > | :------------ | :------------ | :------------ | :------------ |
60
+ > | height | Chatting area height. | Number | 300 |
61
+ > | contactAvatar | URL of other avartar, display on the left. | String | - |
62
+ > | ownerAvatar | URL of own avartar, display on the right. | String | - |
63
+ > | oriData | Chat message, once at start time. | Array | [ ] |
64
+ > ### Menu events
65
+ > | events | Introductions | return |
66
+ > | :------------ | :------------ | :------------ |
67
+ > | on-avatar-click | Triggered when a avatar is clicked. | Which avatar was clicked (0: own, 1: other). |
68
+ > | load-more | Drag to top and get more data. | A function callback contains success status and data. |
69
+ > | on-msg-send | Triggered when the message to be sent is ready and the sending button is clicked. | The message of sending. |
70
+ >
71
+ > When you received a new message, use ` this.$bus.emit('new-chat-data', message) ` with ` vue-bus ` on parent to provide the new message to this component.
72
+
73
+ ## ChatCell
74
+
75
+ > A cell include contact avatar, nickname, last massage and time.
76
+ > ### Menu props
77
+ > | props | Introductions | type | default |
78
+ > | :------------ | :------------ | :------------ | :------------ |
79
+ > | avatar | Avartar URL. | String | '' |
80
+ > | nickname | Nickname or display name. | String | '' |
81
+ > | msg | The last message. | String | '' |
82
+ > | time | The sent time of last message. | String | '' |
83
+ > | circle-avatar | Display the avatar in circle or not. | Boolean | false |
84
+
85
+ ## ChatGroup
86
+ > The contacts list container, each info including other's avatar, the last message of the chat, the last time. Consists of the ` chat-cell ` component.
87
+ > ### Menu props
88
+ > | props | Introductions | type | default |
89
+ > | :------------ | :------------ | :------------ | :------------ |
90
+ > | data | Contacts list data. | Array| [ ] |
91
+ > ### Menu events
92
+ > | events | Introductions | return |
93
+ > | :------------ | :------------ | :------------ |
94
+ > | on-cell-click | A item is clicked. | click index, content. |
95
+
96
+ ## ChatDialog
97
+ > Pop a dialog in custom.
98
+ > ### Menu props
99
+ > | props | Introductions | type | default |
100
+ > | :------------ | :------------ | :------------ | :------------ |
101
+ > | type | Dialog type (text dialog or input dialog). | Number | 0 |
102
+ > | show | Dialog display. | Boolean | false |
103
+ > | title | Dialog title. | String | false |
104
+ > | content | Dialog content. | String | '' |
105
+ > | positive-btn | Display text on positive button. | String | 'Confirm'|
106
+ > | negative-btn | Display text on negative button. | String | 'Cancel'|
107
+ > ### Menu events
108
+ > | events | Introductions | return |
109
+ > | :------------ | :------------ | :------------ |
110
+ > | positive-btn-click | When the positive button is pressed. | content |
111
+ > | negative-btn-click | When the nagative button is pressed. | - |
112
+
113
+ ## ChatHeader
114
+ > The top header.
115
+ > ### Menu props
116
+ > | props | Introductions | type | default |
117
+ > | :------------ | :------------ | :------------ | :------------ |
118
+ > | height | The height occupied by the header. | Number | 50 |
119
+ > | back | Display the back option. | Boolean | true |
120
+ > | title | The content of the header. | String | '' |
121
+ > | fixed | The position of the header use fixed or not. | Boolean | false |
0 commit comments