Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <template>
  2. <div class="chat-history p-1 p-md-3" ref="container">
  3. <ul v-if="messages">
  4. <li v-for="message in messages.data" class="clearfix">HERE IS THE HTML FOR THE MESSAGE</li>
  5. </ul>
  6. </div>
  7. </template>
  8.  
  9. getMessages() {
  10. if(window.hashed_session != "none") {
  11. this.messages = JSON.parse(sessionStorage.getItem(`${window.hashed_session}.conversations.${this.conversation.id}`));
  12. var container = this.$refs.container;
  13. container.scrollTop = container.scrollHeight;
  14. }
  15. axios.get(AJAX Settings)
  16. .then((response) => {
  17. response.data.data.reverse();
  18. this.messages = response.data;
  19. if(window.hashed_session != "none") {
  20. sessionStorage.setItem(`${window.hashed_session}.conversations.${this.conversation.id}`, JSON.stringify(response.data));
  21. }
  22. var container = this.$refs.container;
  23. container.scrollTop = container.scrollHeight;
  24. });
  25. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement