Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
How can I substitute an array for a slot in vuejs?

I'm making a custom component (a slider), but for now it only passes images through an array, what I want is that instead of passing images, I can insert a child component through a slot without using arrays.

<div class="carousel">
<transition-group tag='ul' class="clearfix slide" name='image'>
  <li v-for='(image,index) in imglist' :key='index' v-show='index===mark'>
    <a><img :src="image"></a>
  </li>
</transition-group>
<div class="bullet">
  <span v-for='(item,index) in imglist.length' v-bind:key="item" :class="{'active':index===mark}" @click='change(index)'></span>
</div>

this is the script

 data() {
    return {
      mark: 0,
       imglist: ['images/bn1.jpg',
    'images/bn2.jpg',
    'images/bn3.jpg'
  ]
    }
  },
  created() {
    this.play()
  },
  methods: {
    change(i) {
      this.mark = i
    },
    autoPlay() {
      this.mark++;
      if (this.mark === this.imglist.length) {
        this.mark = 0;
        return
      }
    },
    play() {
      setInterval(this.autoPlay, 3000)
    }
  }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!