Giter VIP home page Giter VIP logo

Comments (6)

dogversioning avatar dogversioning commented on August 16, 2024 32

Adding this here as it is the only relevant google result atm for bulma extensions and Vue and maybe it will help the next person searching on this. In order to use bulma-extensions with Vue, you need to create a data element to store the results of your attach call in, so that Vue will be aware of the reactiveness inside of the virtual DOM, and then wait for the component to be mounted before actually calling the relevant bulma extension's attach function. An example script section of a component using bulma accordion:

<script>
    import bulmaAccordion from 'bulma-extensions/bulma-accordion/dist/js/bulma-accordion.min.js'
    import 'bulma-extensions/bulma-accordion/dist/css/bulma-accordion.min.css';
    export default{
        data () {
            return{
                accordions : []
            }
        },
        mounted: function() {
                this.accordions = bulmaAccordion.attach()
        },
        name: 'myComponentName',
}
</script>

You can import the css globally instead, but the javascript must be imported at the component level.

from bulma-extensions.

Wikiki avatar Wikiki commented on August 16, 2024 9

Please follow documentation at: https://wikiki.github.io/

from bulma-extensions.

Wikiki avatar Wikiki commented on August 16, 2024 1

Hi,

did you tried:

npm install sass-loader --save-dev

and

npm install --save-dev node-sass

from bulma-extensions.

anandutk avatar anandutk commented on August 16, 2024

And how should I include these all files to my project? I'm trying -
Import bulma from 'bulma-extentions'

from bulma-extensions.

sharmaankit25 avatar sharmaankit25 commented on August 16, 2024

window.Vue = require('vue');
import Buefy from 'buefy';
import {bulmaAccordion,bulmaSteps} from 'bulma-extensions/dist/js/bulma-extensions.min';
Vue.use(Buefy, {
defaultIconPack: 'fas',
});

const app = new Vue({
el: '#app',
mounted:function(){
bulmaAccordion.attach();
bulmaSteps.attach();
}
});

from bulma-extensions.

lbssousa avatar lbssousa commented on August 16, 2024

This is an example of Vue component I've wrote for a project, which wraps bulma-carousel. You could extend it for any other bulma-extension. It encapsulates each bulma-carousel instance individually, so there's no need to use those bulmaExtension.attach() static methods.

(NOTE: This example depends on another component I've written for bulma-carousel navigation buttons, but it's omitted here).

<template>
  <div
    ref="thisCarousel"
    :class="[{
      'carousel': !hero
    }, {
      'hero-carousel': hero
    }, {
      'carousel-animated': animation === 'slide' || animation === 'fade'
    }, {
      'carousel-animate-slide': animation === 'slide'
    }, {
      'carousel-animate-fade': animation === 'fade'
    }]"
    :data-size="size > 1"
    :data-autoplay="autoplay"
    :data-delay="delay"
  >
    <div class="carousel-container">
      <slot/>
    </div>

    <McbCarouselNavigation layout="overlay"/>
  </div>
</template>

<script>
import BulmaCarousel from 'bulma-carousel/dist/js/bulma-carousel.min'

import McbCarouselNavigation from '../molecules/McbCarouselNavigation'

export default {
  name: 'McbCarousel',
  components: {
    McbCarouselNavigation
  },
  props: {
    hero: {
      type: Boolean,
      default: false
    },
    animation: {
      type: String,
      default: 'slide'
    },
    autoplay: {
      type: Boolean,
      default: false
    },
    delay: {
      type: Number,
      default: 5000
    },
    size: {
      type: Number,
      default: 1
    }
  },
  data () {
    return {
      bulmaExtensions: {}
    }
  },
  mounted () {
    this.bulmaExtensions.carousel = new BulmaCarousel(this.$refs.thisCarousel)
  }
}
</script>

from bulma-extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.