loading Loading
Displayed when fetching data or loading to indicate the user should wait.
Basic Usage
The simplest loading indicator.
<template>
<div class="demo-loading">
<b-loading></b-loading>
</div>
</template>
<style scoped>
.demo-loading {
position: relative;
overflow: hidden;
display: inline-block;
margin-right: 5px;
width: 200px;
height: 100px;
border-radius: 4px;
border: 1px solid #cecece;
}
</style>Center Fixed
Can be fixed at the center of the parent element. Defaults to centered fixed. When fix is set to false, it's used for scenarios like pull-down loading.
I am the paragraph behindI am the paragraph behindI am the paragraph behindI am the paragraph behind
<template>
<div class="demo-loading">
<div>I am the paragraph behindI am the paragraph behindI am the paragraph behindI am the paragraph behind</div>
<b-loading fix></b-loading>
</div>
</template>
<style scoped>
.demo-loading {
position: relative;
overflow: hidden;
display: inline-block;
margin-right: 5px;
width: 200px;
height: 100px;
border-radius: 4px;
border: 1px solid #cecece;
}
</style>Custom content
Custom text and content can be configured.
Loading...
loading
loading
<template>
<div>
<div class="demo-loading">
<b-loading fix>Loading...</b-loading>
</div>
<div class="demo-loading">
<b-loading fix show-text="loading"></b-loading>
</div>
<div class="demo-loading">
<b-loading fix show-text="loading" show-icon="loading2"></b-loading>
</div>
</div>
</template>
<style scoped>
.demo-loading {
position: relative;
overflow: hidden;
display: inline-block;
margin-right: 5px;
width: 200px;
height: 100px;
border-radius: 4px;
border: 1px solid #cecece;
}
</style>Toggle Display State
Toggle the display state.
I am the paragraph behindI am the paragraph behindI am the paragraph behindI am the paragraph behind
<template>
<div>
<div class="demo-loading">
<div>I am the paragraph behindI am the paragraph behindI am the paragraph behindI am the paragraph behind</div>
<b-loading v-show="loading" fix></b-loading>
</div>
<div>
<b-button v-if="loading" type="danger" @click="loading = false">Stop</b-button>
<b-button v-else @click="loading = true">Load</b-button>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const loading = ref(false)
</script>
<style scoped>
.demo-loading {
position: relative;
overflow: hidden;
display: inline-block;
margin-right: 5px;
width: 200px;
height: 100px;
border-radius: 4px;
border: 1px solid #cecece;
}
</style>Props
| Parameter | Description | Type | Options | Default |
|---|---|---|---|---|
| showIcon | Showloadingicon | String | loading | — |
| showText | Text displayed while loading | String | loading | — |
| fix | Whether to fix at the center of the parent | Boolean | — | true |
| size | Text display size | Number | — | — |