Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to custom loaders? #40

Closed
niightly opened this issue Dec 2, 2019 · 2 comments
Closed

Add support to custom loaders? #40

niightly opened this issue Dec 2, 2019 · 2 comments
Labels

Comments

@niightly
Copy link

niightly commented Dec 2, 2019

do you have or intend to add support to custom loaders instead of the 3 predefined?

I have one on my own, and I want to use it instead of dots, spinners and things like that.

@niightly niightly changed the title Support To Custom loaders? Add support to custom loaders? Dec 2, 2019
@ankurk91
Copy link
Owner

ankurk91 commented Dec 2, 2019

This is documented here
https://github.com/ankurk91/vue-loading-overlay#vueloadingshowpropsdataslots

// Pass slots by their names
  default: this.$createElement('your-custom-loader-component-name'),

You can find the working example in examples folder as well.

@chris
Copy link

chris commented Aug 28, 2020

This may be obvious to others with more Vue experience than me. Also, I'm using Nuxt, which may mean this is a bit different. But here's how I did it:

  1. Create a new component that is some SVG you want for your loader. In my case it was a fully custom animation and graphic in the SVG, so I didn't need any custom props. e.g. in a LogoLoader.vue file:

    <template>
      <svg ...>
    </template>
    
    <script>
    export default {
      name: 'Logo',
    }
    </script>
    
  2. Add the component in the page/template I was using it on:

    import LogoLoader from '~/components/LogoLoader.vue'
    
    export default {
      components: {
        Loader,
        LogoLoader,
      }
    }
    
  3. Specify the custom loader via slot, in component use:

    <loading
      :active.sync="isLoading"
      :is-full-page="loader.fullPage"
    >
      <LogoLoader />
    </loading>
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants