3.0.0-alpha.1 • Published 6 years ago

@freshes/loading-icon v3.0.0-alpha.1

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

@freshes/loadingIcon

Base usage

Base usage use the freshes universal usage.

Set custom icon in loading-icon globally

import options from '@freshes/options'
import customIcon from './customIcon.vue'

// Global use customIcon
options.set('loading', customIcon)

Set custom icon in the specified loading-icon

<template>
  <mn-loading-icon :icon="customIcon"></mn-loading-icon>
</template>

<script>
  import customIcon from './customIcon.vue'
  import loadingIcon from '@freshes/loadingIcon'

  export default {
    components: {
      ...loadingIcon.map()
    },
    data () {
      return {
        customIcon
      }
    }
  }
</script>

Create many different loading-icons with custom icon by Mixins

// appLoadingIcon.vue
import customIcon from './customIcon.vue'
import loadingIcon from '@freshes/loadingIcon'

export default {
  name: 'app-loading-icon',
  mixins: [
    loadingIcon['mn-loading-icon']
  ],
  props: {
    icon: {
      type: Object,
      default () {
        const Component = Vue.extend(customIcon)
        return new Component().$mount()
      }
    }
  }
}
<template>
  <app-loading-icon></app-loading-icon>
</template>

<script>
  import appLoadingIcon from './appLoadingIcon.vue'

  export default {
    components: {
      appLoadingIcon
    }
  }
</script>