1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
const MAX_CHAT_LEN = 50 const UI = { el: '#chat', data: { messages: [ ], }, computed: { msg() { return this.messages.filter(m => m.length > 0).slice(-MAX_CHAT_LEN) }, }, }