2017-12-05 21:02:41 +11:00
|
|
|
const chat = {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
currentMessage: '',
|
|
|
|
channel: null
|
|
|
|
}
|
|
|
|
},
|
2017-12-05 21:47:10 +11:00
|
|
|
computed: {
|
|
|
|
messages () {
|
|
|
|
return this.$store.state.chat.messages
|
|
|
|
}
|
2017-12-05 21:02:41 +11:00
|
|
|
},
|
|
|
|
methods: {
|
2017-12-05 21:49:40 +11:00
|
|
|
submit (message) {
|
2017-12-05 21:47:10 +11:00
|
|
|
this.$store.state.chat.channel.push('new_msg', {text: message}, 10000)
|
2017-12-05 21:49:40 +11:00
|
|
|
this.currentMessage = ''
|
2017-12-05 21:02:41 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-05 21:49:40 +11:00
|
|
|
export default chat
|