空状态需要处理,需要添加分享页面
This commit is contained in:
21
components/cb-empty/cb-empty.vue
Normal file
21
components/cb-empty/cb-empty.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
name: {
|
||||
type: String,
|
||||
default: '空状态'
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="cb-empty">
|
||||
<image
|
||||
src="/static/images/public/empty-icon.png"
|
||||
mode="scaleToFill"
|
||||
class="left-img"
|
||||
></image>
|
||||
<text class="bottom-name">{{ props.name }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
18
components/cb-loading/cb-loading.vue
Normal file
18
components/cb-loading/cb-loading.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
/** 距离顶部高度 */
|
||||
top: {
|
||||
type: Number,
|
||||
default: 32
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<uni-load-more
|
||||
:style="{ 'margin-top': `${props.top}rpx` }"
|
||||
status="loading"
|
||||
></uni-load-more>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
50
components/cb-skeleton/cb-skeleton.vue
Normal file
50
components/cb-skeleton/cb-skeleton.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<view v-if="loading" class="cb-skeleton">
|
||||
<slot name="skeleton">
|
||||
<view v-for="i in rows" :key="i" class="skeleton-line"></view>
|
||||
</slot>
|
||||
</view>
|
||||
<slot v-else />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
rows: {
|
||||
type: Number,
|
||||
default: 3
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cb-skeleton {
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.skeleton-line {
|
||||
height: 32rpx;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
#f0f0f0 25%,
|
||||
#e0e0e0 50%,
|
||||
#f0f0f0 75%
|
||||
);
|
||||
background-size: 200% 100%;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
0% {
|
||||
background-position: 200% 0;
|
||||
}
|
||||
100% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -9,14 +9,22 @@
|
||||
/** 是否带背景 */
|
||||
isTopBg: { type: Boolean, default: false },
|
||||
/** 是否有占位符 */
|
||||
isPlaceholder: { type: Boolean, default: false }
|
||||
isPlaceholder: { type: Boolean, default: false },
|
||||
/** 是否自定义返回事件 */
|
||||
isCustomBack: { type: Boolean, default: false }
|
||||
})
|
||||
|
||||
const emits = defineEmits(['onBack'])
|
||||
|
||||
// 判断是否传入了名为 "back" 的插槽
|
||||
const hasBackSlot = !!slots.back
|
||||
|
||||
const onBack = () => {
|
||||
navigateBack()
|
||||
if (props.isCustomBack) {
|
||||
emits('onBack')
|
||||
} else {
|
||||
navigateBack()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user