create account

Make carousel in vue with vue-carousel by alfarisi94

View this thread on: hive.blogpeakd.comecency.com
· @alfarisi94 · (edited)
$30.19
Make carousel in vue with vue-carousel
![Flexible-Responsive-Carousel-Component-For-Vue.js.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514871080/bgrrxrmizv0xbvzgnpog.png)

<a href="https://i1.wp.com/www.vuescript.com/wp-content/uploads/2016/12/Flexible-Responsive-Carousel-Component-For-Vue.js.png?w=500">image-source</a>
This tutorial I will share the features that we often encounter in the web, and more often in use on the modern web. that feature is carousel. there are so many repositories that make the carousel, but after I browse. I think the best and most complete is <b>https://github.com/SSENSE/vue-carousel</b>
just start we start how to implement it.

## How to Install ?
How to install it is very easy, we can directly install via NPM in the following way.
<code>npm install -S vue-carousel</code>
![Screenshot_27.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514823257/tfpfqrvwdc0nqyjyh7vs.png (12 kB))
and then you must registered vue carousel in <b>main.js</b>
<pre><code>import VueCarousel from 'vue-carousel';
Vue.use(VueCarousel) ;
</code>
</pre>
<code>import VueCarousel from 'vue-carousel' ;</code>  Import the vue-carousel and then used then carousel <code>Vue.use(VueCarousel) ;</code> 

## How to Implement it ?
We have imported and registered it. now we will implement it. I have created one component that I named <b>parentComponents.vue</b> . this is the code.
``` html
<template>
  <div class="wrapper-parent">
    <carousel paginationActiveColor="#73c000" paginationPadding=5 autoplayTimeout:1000>
      <slide>
          <img src="../assets/image-3.jpeg">
      </slide>
      <slide>
          <img src="../assets/image-6.jpeg">
      </slide>
      <slide>
          <img src="../assets/image-4.jpeg">
      </slide>
      <slide>
          <img src="../assets/image-5.jpeg">
      </slide>
       <slide>
          <img src="../assets/image-7.jpeg">
      </slide>
    </carousel>
  </div>
</template>

<script>
import { Carousel, Slide } from 'vue-carousel';
export default {
   components: {
    Carousel,
    Slide
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.wrapper-parent{
  width: auto;
}
</style>
```
<br />
<code>import { Carousel, Slide } from 'vue-carousel' ;</code> : Import the 'vue-carousel' in local component. and we import two components inside the vue carousel are <b>Carousel</b> and <b>Slide</b>.
<pre><code>
  components: {
    Carousel,
    Slide
  }
</code>
</pre>
We registered the components we have imported. and then we can use it in the components. the structure default given by <b>Vue carousel</b> . its like this.
<pre><code>
< carousel >
< slide >
    Slide 1 Content
< /slide >
< slide >
    Slide 2 Content
< /slide >
< /carousel >
</code>
</pre>
We can costume the structure. and in this tutorial . i will make 5 image as example.
<pre><code>
< carousel paginationActiveColor="#73c000"  autoplayTimeout:1000 >
< slide >
< img src=" ../assets/image-3.jpeg " >
< /slide >
< slide >
< img src=" ../assets/image-6.jpeg " >
< /slide >
< slide >
< img src=" ../assets/image-4.jpeg " >
< /slide >
< slide >
< img src="../assets/image-5.jpeg" >
</slide>
<slide>
< img src=" ../assets/image-7.jpeg " >
< /slide >
< /carousel >
</code>
</pre>
<code>paginationActiveColor =" #73c000 " </code> : its to set your  color dot paginations.
<code>autoplayTimeout:1000</code> :  its to set auto play , you can add the time in second with type integer.  You can add any element in the <b> < slide >< /slide ></b> .

## The Result of code
![Screenshot_1.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870202/gpe4hjwb9d9ewzoprdp1.png)

![Screenshot_2.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870340/xyyavfzdfxhlpwehqood.png)

![Screenshot_28.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870346/gvrbr8kgxkkfqjcall5g.png)
![Screenshot_29.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870355/zem6ynzt8ybbjbynzxis.png)


These is the result of the carousel we have done. You can see other options options to customize. carousel you want. So many of you I hope this tutorial you get the benefit to build a carousel on your website. thank you

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@alfarisi94/make-carousel-in-vue-with-vue-carousel">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authoralfarisi94
permlinkmake-carousel-in-vue-with-vue-carousel
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":77561581,"name":"vue-carousel","full_name":"SSENSE/vue-carousel","owner":{"login":"SSENSE","id":17600947,"avatar_url":"https://avatars2.githubusercontent.com/u/17600947?v=4","gravatar_id":"","url":"https://api.github.com/users/SSENSE","html_url":"https://github.com/SSENSE","followers_url":"https://api.github.com/users/SSENSE/followers","following_url":"https://api.github.com/users/SSENSE/following{/other_user}","gists_url":"https://api.github.com/users/SSENSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SSENSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SSENSE/subscriptions","organizations_url":"https://api.github.com/users/SSENSE/orgs","repos_url":"https://api.github.com/users/SSENSE/repos","events_url":"https://api.github.com/users/SSENSE/events{/privacy}","received_events_url":"https://api.github.com/users/SSENSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SSENSE/vue-carousel","description":"A flexible, responsive, touch-friendly carousel for Vue.js","fork":false,"url":"https://api.github.com/repos/SSENSE/vue-carousel","forks_url":"https://api.github.com/repos/SSENSE/vue-carousel/forks","keys_url":"https://api.github.com/repos/SSENSE/vue-carousel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SSENSE/vue-carousel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SSENSE/vue-carousel/teams","hooks_url":"https://api.github.com/repos/SSENSE/vue-carousel/hooks","issue_events_url":"https://api.github.com/repos/SSENSE/vue-carousel/issues/events{/number}","events_url":"https://api.github.com/repos/SSENSE/vue-carousel/events","assignees_url":"https://api.github.com/repos/SSENSE/vue-carousel/assignees{/user}","branches_url":"https://api.github.com/repos/SSENSE/vue-carousel/branches{/branch}","tags_url":"https://api.github.com/repos/SSENSE/vue-carousel/tags","blobs_url":"https://api.github.com/repos/SSENSE/vue-carousel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SSENSE/vue-carousel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SSENSE/vue-carousel/git/refs{/sha}","trees_url":"https://api.github.com/repos/SSENSE/vue-carousel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SSENSE/vue-carousel/statuses/{sha}","languages_url":"https://api.github.com/repos/SSENSE/vue-carousel/languages","stargazers_url":"https://api.github.com/repos/SSENSE/vue-carousel/stargazers","contributors_url":"https://api.github.com/repos/SSENSE/vue-carousel/contributors","subscribers_url":"https://api.github.com/repos/SSENSE/vue-carousel/subscribers","subscription_url":"https://api.github.com/repos/SSENSE/vue-carousel/subscription","commits_url":"https://api.github.com/repos/SSENSE/vue-carousel/commits{/sha}","git_commits_url":"https://api.github.com/repos/SSENSE/vue-carousel/git/commits{/sha}","comments_url":"https://api.github.com/repos/SSENSE/vue-carousel/comments{/number}","issue_comment_url":"https://api.github.com/repos/SSENSE/vue-carousel/issues/comments{/number}","contents_url":"https://api.github.com/repos/SSENSE/vue-carousel/contents/{+path}","compare_url":"https://api.github.com/repos/SSENSE/vue-carousel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SSENSE/vue-carousel/merges","archive_url":"https://api.github.com/repos/SSENSE/vue-carousel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SSENSE/vue-carousel/downloads","issues_url":"https://api.github.com/repos/SSENSE/vue-carousel/issues{/number}","pulls_url":"https://api.github.com/repos/SSENSE/vue-carousel/pulls{/number}","milestones_url":"https://api.github.com/repos/SSENSE/vue-carousel/milestones{/number}","notifications_url":"https://api.github.com/repos/SSENSE/vue-carousel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SSENSE/vue-carousel/labels{/name}","releases_url":"https://api.github.com/repos/SSENSE/vue-carousel/releases{/id}","deployments_url":"https://api.github.com/repos/SSENSE/vue-carousel/deployments","created_at":"2016-12-28T21:11:47Z","updated_at":"2017-12-28T16:27:53Z","pushed_at":"2017-12-13T23:57:24Z","git_url":"git://github.com/SSENSE/vue-carousel.git","ssh_url":"git@github.com:SSENSE/vue-carousel.git","clone_url":"https://github.com/SSENSE/vue-carousel.git","svn_url":"https://github.com/SSENSE/vue-carousel","homepage":"https://ssense.github.io/vue-carousel/","size":8500,"stargazers_count":266,"watchers_count":266,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":72,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":72,"open_issues":53,"watchers":266,"default_branch":"master","score":107.0204},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","vue","carousel","frontend","web"],"users":["alfarisi94"],"links":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1514871080/bgrrxrmizv0xbvzgnpog.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514823257/tfpfqrvwdc0nqyjyh7vs.png (12 kB","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870202/gpe4hjwb9d9ewzoprdp1.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870340/xyyavfzdfxhlpwehqood.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870346/gvrbr8kgxkkfqjcall5g.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870355/zem6ynzt8ybbjbynzxis.png"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1514871080/bgrrxrmizv0xbvzgnpog.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514823257/tfpfqrvwdc0nqyjyh7vs.png (12 kB","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870202/gpe4hjwb9d9ewzoprdp1.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870340/xyyavfzdfxhlpwehqood.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870346/gvrbr8kgxkkfqjcall5g.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514870355/zem6ynzt8ybbjbynzxis.png"],"moderator":{"account":"manishmike10","reviewed":true,"pending":false,"flagged":false}}"
created2018-01-02 05:23:12
last_update2018-01-07 00:41:33
depth0
children2
last_payout2018-01-09 05:23:12
cashout_time1969-12-31 23:59:59
total_payout_value21.064 HBD
curator_payout_value9.124 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,366
author_reputation5,678,893,550,406
root_title"Make carousel in vue with vue-carousel"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,492,433
net_rshares3,100,440,541,975
author_curate_reward""
vote details (28)
@manishmike10 ·
$0.24
Thank you for the contribution. It has been approved.

You can contact us on [Discord](https://discord.gg/UCvqCsx).
**[[utopian-moderator]](https://utopian.io/moderators)**
👍  
properties (23)
authormanishmike10
permlinkre-alfarisi94-make-carousel-in-vue-with-vue-carousel-20180103t134759474z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-03 13:48:03
last_update2018-01-03 13:48:03
depth1
children0
last_payout2018-01-10 13:48:03
cashout_time1969-12-31 23:59:59
total_payout_value0.242 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length172
author_reputation20,399,732,899,016
root_title"Make carousel in vue with vue-carousel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,783,492
net_rshares20,996,168,687
author_curate_reward""
vote details (1)
@utopian-io ·
### Hey @alfarisi94 I am @utopian-io. I have just upvoted you!
#### Achievements
- You have less than 500 followers. Just gave you a gift to help you succeed!
- Seems like you contribute quite often. AMAZING!
#### Suggestions
- Contribute more often to get higher and higher rewards. I wish to see you often!
- Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!
#### Get Noticed!
- Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!
#### Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a>
- Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)

**Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
properties (22)
authorutopian-io
permlinkre-alfarisi94-make-carousel-in-vue-with-vue-carousel-20180104t064739740z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-01-04 06:47:39
last_update2018-01-04 06:47:39
depth1
children0
last_payout2018-01-11 06:47:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,508
author_reputation152,955,367,999,756
root_title"Make carousel in vue with vue-carousel"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,963,638
net_rshares0