Search code examples
javascriptspinnervue.js

Spinner not working vue.js


I use this package: https://github.com/greyby/vue-spinner for showing a spinner.

<template>
  <pulse-loader :loading="loading" :color="color" :size="size"></pulse-loader>
</template>

<script>

import { PulseLoader } from 'vue-spinner/dist/vue-spinner.min.js';

export default {

  components: { PulseLoader },

  data () {
    return {
      loading: true,
      color: "black",
      size: "10"
    }
  }
}
</script>

For some reason the spinner is not showing???!?! There are no erros in my console!


Solution

  • You should not be importing from the dist folder.

    Please, try importing the vue component source, doing as shown in the documentation:

    import PulseLoader from 'vue-spinner/src/PulseLoader.vue'
    

    Docs: https://github.com/greyby/vue-spinner#es6


    UPDATE:

    Considering Browserify restriction on applying transforms in files inside node_modules, then you could try the code snippet provided in the mentioned GitHub issue:

    var PulseLoader = require('vue-spinner/dist/vue-spinner.min').PulseLoader;