Advertisement
linuxyamigos

Untitled

Feb 7th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.     <span>{{ text }}</span>
  3. </template>
  4.  
  5. <script>
  6. export default {
  7.     name: 'AnimatedText',
  8.     data() {
  9.         return {
  10.             pt: 0,
  11.             list: [
  12.                 { msg: 'Administración de consorcios' },
  13.                 { msg: 'Número 1 en La Plata' },
  14.                 { msg: 'El Grove' }
  15.             ]
  16.         };
  17.     },
  18.     computed: {
  19.         text: function () {
  20.             //console.log (this.list);
  21.  
  22.             let out = '....';
  23.            
  24.             console.log(this.list[this.pt]);  // __ob__
  25.             console.log(this.list[this.pt]['direction']);  // __undefined__
  26.  
  27.             if (this.list[this.pt].direction == 1){
  28.                 if (this.list[this.pt].offset < this.list[this.pt].len){
  29.                     console.log ('*');
  30.                     this.list[this.pt].offset++;
  31.                     out = this.list[this.pt].msg.slice(0, this.list[this.pt].offset);
  32.                 }
  33.             }else {
  34.                 // ...
  35.             }
  36.             return out;
  37.         }
  38.     },
  39.     mounted() {
  40.         for (let i=0; i< this.list.length; i++){
  41.             this.list[i].len = this.list[i].msg.length;
  42.             this.list[i].offset = 0;
  43.             this.list[i].direction = 1;
  44.         }
  45.         //console.log (this.list);
  46.     }
  47. }
  48. </script>
  49.  
  50. <style scoped>
  51. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement