前端Vue自定義加載中loading加載結束end組件 可用于分頁展示 頁面加載請求, 請訪問uni-app插件市場地址:https://ext.dcloud.net.cn/plugin?id=13219
效果圖如下:
實作代碼如下:
cc-paging
使用方法
<!-- 加載中用法 isLoading:是否加載 isEnd:是否結束加載 -->
<cc-paging :isLoading="true" :isEnd="false"></cc-paging>
<!-- 加載完成 isLoading:是否加載 isEnd:是否結束加載-->
<cc-paging :isEnd="true" :isLoading="false"></cc-paging>
HTML代碼實作部分
<template>
<view >
<view style="margin-left: 20px;"> 基本用法 </view>
<!-- 加載中用法 isLoading:是否加載 isEnd:是否結束加載 -->
<cc-paging :isLoading="true" :isEnd="false"></cc-paging>
<!-- 加載完成 isLoading:是否加載 isEnd:是否結束加載-->
<cc-paging :isEnd="true" :isLoading="false"></cc-paging>
<view style="margin-left: 20px;"> 動態使用用法 </view>
<!-- 加載中用法 -->
<cc-paging :isEnd="!isLoad" :isLoading="isLoad"></cc-paging>
<button @click="changeStatusClick">切換狀態</button>
</view>
</template>
<script>
export default {
data() {
return {
isLoad: true
}
},
methods: {
changeStatusClick() {
this.isLoad = !this.isLoad;
}
}
}
</script>
<style>
page {
background: white;
}
.content {
display: flex;
padding-top: 29px;
flex-direction: column;
}
</style>
組件實作代碼
<template>
<view >
<slot></slot>
<view v-if="isLoading">
<view >
<image lazyLoad src="https://img.uj5u.com/2023/06/27/356135270937181.gif"></image>
<view >加載中</view>
</view>
</view>
<view v-if="isEnd">我是有底線的哦~</view>
</view>
</template>
<script>
export default {
data() {
return {};
},
props: {
isEnd: {
type: Boolean,
default: false
},
isLoading: {
type: Boolean,
default: false
}
}
};
</script>
<style>
@import './index.css';
</style>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/556093.html
標籤:HTML5
上一篇:前端Vue自定義支付密碼輸入鍵盤Keyboard和支付設定輸入框Input
下一篇:返回列表