Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <div class="chat-history p-1 p-md-3" ref="container">
- <ul v-if="messages">
- <li v-for="message in messages.data" class="clearfix">HERE IS THE HTML FOR THE MESSAGE</li>
- </ul>
- </div>
- </template>
- getMessages() {
- if(window.hashed_session != "none") {
- this.messages = JSON.parse(sessionStorage.getItem(`${window.hashed_session}.conversations.${this.conversation.id}`));
- var container = this.$refs.container;
- container.scrollTop = container.scrollHeight;
- }
- axios.get(AJAX Settings)
- .then((response) => {
- response.data.data.reverse();
- this.messages = response.data;
- if(window.hashed_session != "none") {
- sessionStorage.setItem(`${window.hashed_session}.conversations.${this.conversation.id}`, JSON.stringify(response.data));
- }
- var container = this.$refs.container;
- container.scrollTop = container.scrollHeight;
- });
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement