0.1.0 • Published 6 years ago

vue-chat-ui v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

ChatUI

image

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

Code Organization

├── build                      
├── config           
├── preview                      // project preview image
├── src                          // the source files
│   ├── assets                   // static image resource
│   ├── components        
│   │   ├── chat_area.vue        // provide chatting view
│   │   ├── chat_cell.vue        // a cell include contact simple data
│   │   ├── chat_dialog.vue      // pop dialog
│   │   ├── chat_group.vue       // chat-cell group
│   │   ├── chat_header.vue      // top header
│   │   └── chat_pop_bubble.vue  // small bubble clickable
│   ├── pages 
│   │   ├── chat.vue             // chat-each-other view
│   │   ├── index.vue            // contact list
│   │   ├── overview.vue         // contact profile view
│   │   ├── page_transition.vue  // page transition animate
│   │   ├── pay.vue              // pay for VIP
│   │   └── theme.vue            // change theme
│   ├── router
│   │   └── index.js             // vue router setting
│   ├── scripts                  // scripts resource
│   ├── styles                   // css resource
│   ├── App.vue                  // page entry file
│   └── main.js                  // program entry file, load components
├── .babelrc
├── .gitigore
├── data.json                    // analog data of back end
├── index.html                   // entry html
├── LICENSE
├── package-lock.json
├── package.json
└── README.md

Components

ChatArea

Provide the conversation view and the message sender of each chatting.

Menu props

propsIntroductionstypedefault
heightChatting area height.Number300
contactAvatarURL of other avartar, display on the left.String-
ownerAvatarURL of own avartar, display on the right.String-
oriDataChat message, once at start time.Array[]

Menu events

eventsIntroductionsreturn
on-avatar-clickTriggered when a avatar is clicked.Which avatar was clicked (0: own, 1: other).
load-moreDrag to top and get more data.A function callback contains success status and data.
on-msg-sendTriggered when the message to be sent is ready and the sending button is clicked.The message of sending.

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.

ChatCell

A cell include contact avatar, nickname, last massage and time.

Menu props

propsIntroductionstypedefault
avatarAvartar URL.String''
nicknameNickname or display name.String''
msgThe last message.String''
timeThe sent time of last message.String''
circle-avatarDisplay the avatar in circle or not.Booleanfalse

ChatGroup

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.

Menu props

propsIntroductionstypedefault
dataContacts list data.Array[]

Menu events

eventsIntroductionsreturn
on-cell-clickA item is clicked.click index, content.

ChatDialog

Pop a dialog in custom.

Menu props

propsIntroductionstypedefault
typeDialog type (text dialog or input dialog).Number0
showDialog display.Booleanfalse
titleDialog title.Stringfalse
contentDialog content.String''
positive-btnDisplay text on positive button.String'Confirm'
negative-btnDisplay text on negative button.String'Cancel'

Menu events

eventsIntroductionsreturn
positive-btn-clickWhen the positive button is pressed.content
negative-btn-clickWhen the nagative button is pressed.-

ChatHeader

The top header.

Menu props

propsIntroductionstypedefault
heightThe height occupied by the header.Number50
backDisplay the back option.Booleantrue
titleThe content of the header.String''
fixedThe position of the header use fixed or not.Booleanfalse