Properties
Property | Type | Default Value |
---|---|---|
variant | String | primary |
show | Boolean | false |
type | String | border |
small | Boolean | false |
fade | Boolean | false |
fixed | Boolean | false |
v-model
Prop | Event |
---|---|
show | input |
The <b-loading>
component is display loading state icon. Default wrapper is the BootstrapVue
<template>
<div>
<b-form-checkbox v-model="loading" switch>
Switch Loading Status
</b-form-checkbox>
<div v-if="!loading" class="py-3">
<h3>Loading</h3>
<p>Loading can show the loading state icon.</p>
</div>
<b-loading :show="loading"></b-loading>
</div>
</template>
<script>
export default {
data() {
return {
loading: true
}
}
}
</script>
<!-- b-loading.vue -->
Add any of the following variants via the variant
prop to change the appearance of a
<b-loading>
: primary
, secondary
, success
, danger
, warning
, info
, light
, and dark
.
If no variant is specified primary
will be used.
<template>
<b-loading :show="true" variant="primary"></b-loading>
<b-loading :show="true" variant="secondary"></b-loading>
<b-loading :show="true" variant="success"></b-loading>
<b-loading :show="true" variant="danger"></b-loading>
<b-loading :show="true" variant="warning"></b-loading>
<b-loading :show="true" variant="info"></b-loading>
<b-loading :show="true" variant="light"></b-loading>
<b-loading :show="true" variant="dark"></b-loading>
</template>
<!-- b-loading-variations.vue -->
Via the type
prop to set loading type. Bootstrap includes two
types of spinners. The default spinner type is called border
(spinning circle border), and the
optional type grow
(a throbber style indicator).
<template>
<b-loading :show="true" type="grow"></b-loading>
</template>
<!-- b-loading-type.vue -->
Via the size
prop to set size loading.
<template>
<b-loading :show="true"></b-loading>
<b-loading :show="true" small></b-loading>
</template>
<!-- b-loading-size.vue -->
Via the fixed
prop to enable fixed loading.
<template>
<div class="position-relative">
<div class="p-3">
<h3>Loading</h3>
<p>Loading can show the loading state icon.</p>
<button @click="startLoading" class="btn btn-primary">Start loading 2 seconds</button>
</div>
<b-loading :show="loading" fixed></b-loading>
</div>
</template>
<script>
export default {
data() {
return {
loading: false
}
},
methods: {
startLoading() {
this.loading = true
setTimeout(() => {
this.loading = false
}, 2000)
}
}
}
</script>
<!-- b-loading-fixed.vue -->
Use the fade
prop to enable animation. By default loading are not animated. It is recommended to
attach fixed
prop when using.
<template>
<div class="position-relative">
<div class="p-3">
<h3>Loading</h3>
<p>Loading can show the loading state icon.</p>
<button @click="startLoading" class="btn btn-primary">Start loading 2 seconds</button>
</div>
<b-loading :show="loading" fixed fade></b-loading>
</div>
</template>
<script>
export default {
data() {
return {
loading: false
}
},
methods: {
startLoading() {
this.loading = true
setTimeout(() => {
this.loading = false
}, 2000)
}
}
}
</script>
<!-- b-loading-fading.vue -->
Set global config render loading content use string.
Vue.use(Loading, {
BLoading: {
slot: 'Loading...'
}
})
Or set Vue component.
import CustomLoadingComponent from './components/custom-loading.vue'
Vue.use(Loading, {
BLoading: {
slot: CustomLoadingComponent
}
})
Property | Type | Default Value |
---|---|---|
variant | String | primary |
show | Boolean | false |
type | String | border |
small | Boolean | false |
fade | Boolean | false |
fixed | Boolean | false |
Prop | Event |
---|---|
show | input |
Event | Arguments | Description |
---|---|---|
started | Loading started | |
ended | Loading ended |
Component | Import Path |
---|---|
<b-loading> | bootstrap-vue-arsenic/es/components/loading/loading |
Example:
import BLoading from 'bootstrap-vue-arsenic/es/components/loading/loading' Vue.component('b-loading', BLoading)
This plugin includes all of the above listed individual components . Plugins also include any component aliases.
import Loading from 'bootstrap-vue-arsenic/es/components/loading' Vue.use(Loading)