Categories

Thursday, November 21, 2024
#919814419350 therichposts@gmail.com
LaravelLaravl 5.7VueJs

Vue Laravel Bootstrap Owl Carousel Working Example

Hello to all, welcome to therichpost.com. In this post, I will tell you, Vue Laravel Bootstrap Owl Carousel Working Example.

If you are new in laravel and vuejs, then you can check below links to get vue laravel basics information.

https://therichpost.com/category/laravel

https://therichpost.com/category/laravl-5-7

https://therichpost.com/category/vuejs

Here I am showing Bootstrap Owl Carousel working in Vue Laravel:

Vue Laravel Bootstrap Owl Carousel Working Example

Installation & Coding:

Here are the some basic commands need to run into your terminal to install fresh laravel setup:

$ composer create-project --prefer-dist laravel/laravel vuelaraveowlcarousel //install fresh laravel setup

$ cd vuelaraveowlcarousel //go laravel setup

$ npm install //node modules for vuejs

Now come to the vue code into laravel:

Here is the code, you need to add into vuelaraveowlcarousel/resources/js/components/ExampleComponent.vue

<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                 <center><h2>Vue Laravel Bootstrap Owl Carousel Working Example:</h2></center>  
         <div id="demo" class="carousel slide" data-ride="carousel">
          <!-- Indicators -->
          <ol class="carousel-indicators">
            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
          </ol>

          <!-- Wrapper for slides -->
          <div class="carousel-inner">
            <div class="carousel-item active">
            <img src="https://responsivedesign.is/wp-content/uploads/2016/11/Owl-Carousel-2_ri92wj.jpg" alt="Los Angeles" style="width:100%;">
            </div>

            <div class="carousel-item">
            <img src="https://responsivedesign.is/wp-content/uploads/2016/11/Owl-Carousel-2_ri92wj.jpg" alt="Chicago" style="width:100%;">
            </div>
          
            <div class="carousel-item">
            <img src="https://responsivedesign.is/wp-content/uploads/2016/11/Owl-Carousel-2_ri92wj.jpg" alt="New york" style="width:100%;">
            </div>
          </div>

          <!-- Left and right controls -->
            <a class="carousel-control-prev" href="#demo" data-slide="prev">
            <span class="carousel-control-prev-icon"></span>
            </a>
            <a class="carousel-control-next" href="#demo" data-slide="next">
            <span class="carousel-control-next-icon"></span>
            </a>
          </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>

Here is the code you need to add
vuelaraveowlcarousel/resources/js/ app.js file:

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */
window.Vue = require('vue');
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.min.js';
/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

Vue.component('example-component', require('./components/ExampleComponent.vue'));

const app = new Vue({
    el: '#app'
});

Now come to the laravel code to display vue output:

Here is the code you need to add into
vuelaraveowlcarousel/resources/ views/welcome.blade.file:

<div id="app"><example-component></example-component></div>
<script src="{{asset('js/app.js')}}"></script>

This is done. Now run php artisan serve command to see the working output and if you have any query related to this post then please do comment below or ask question.

Thank you

Ludhiane wala ajay

TheRichPost

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.