Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.   <div class="l_content">
  3.     <div class="l_downloads">
  4.       <contentBlock :items="items" :selected="selected"></contentBlock>
  5.     </div>
  6.   </div>
  7. </template>
  8.  
  9. <script>
  10.   import {getData} from '@/helpers/request'
  11.   import ContentBlock from './components/Content.vue'
  12.  
  13.   export default {
  14.     name: 'downloads',
  15.     data () {
  16.       return {
  17.         items: {},
  18.       }
  19.     },
  20.     created () {
  21.       this.getData();
  22.     },
  23.     methods: {
  24.       getData () {
  25.         getData('showListPage:downloads').then(result => {
  26.           result.items.forEach(item => {
  27.             if (!this.items[item.id] || JSON.stringify(this.items[item.id]) !== JSON.stringify(item)) {
  28.               this.$set(this.items, item.id, item)
  29.             }
  30.           });
  31.  
  32.           this.timer = setTimeout(() => {
  33.             this.getData();
  34.           }, 1000);
  35.         });
  36.       }
  37.     },
  38.     components: {
  39.       ContentBlock
  40.     }
  41.   }
  42. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement