添加空状态
This commit is contained in:
@@ -2,20 +2,46 @@
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '空状态'
|
default: '暂无数据'
|
||||||
|
},
|
||||||
|
top: {
|
||||||
|
type: Number,
|
||||||
|
default: 10
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="cb-empty">
|
<view :style="{'margin-top': `${top}vh` }" class="cb-empty">
|
||||||
<image
|
<image
|
||||||
src="/static/images/public/empty-icon.png"
|
src="/static/images/public/empty-icon.png"
|
||||||
mode="scaleToFill"
|
mode="scaleToFill"
|
||||||
class="left-img"
|
class="empty-icon"
|
||||||
></image>
|
></image>
|
||||||
<text class="bottom-name">{{ props.name }}</text>
|
<text class="bottom-name">{{ props.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.cb-empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
width: 285rpx;
|
||||||
|
height: 285rpx;
|
||||||
|
margin-bottom: 64rpx;
|
||||||
|
}
|
||||||
|
.bottom-name {
|
||||||
|
font-family: PingFang SC, PingFang SC;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
text-align: center;
|
||||||
|
font-style: normal;
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,16 +1,23 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { navigateTo } from '@/utils/router'
|
import { navigateTo } from '@/utils/router'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import { getUserAddress, updateUserAddress, deleteUserAddress } from '@/api'
|
import {
|
||||||
|
getUserAddress,
|
||||||
|
updateUserAddress,
|
||||||
|
deleteUserAddress
|
||||||
|
} from '@/api'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useUI } from '@/utils/use-ui'
|
import { useUI } from '@/utils/use-ui'
|
||||||
|
|
||||||
const { showDialog, showToast } = useUI()
|
const { showDialog, showToast } = useUI()
|
||||||
|
|
||||||
const listData = ref([])
|
const listData = ref([])
|
||||||
|
const loading = ref(true)
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
loading.value = true
|
||||||
const res = await getUserAddress({ pageNum: 1, pageSize: 99 })
|
const res = await getUserAddress({ pageNum: 1, pageSize: 99 })
|
||||||
listData.value = res.rows
|
listData.value = res.rows
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
@@ -59,6 +66,9 @@
|
|||||||
<text class="top-right-name" @click="onAdd">添加地址</text>
|
<text class="top-right-name" @click="onAdd">添加地址</text>
|
||||||
</template>
|
</template>
|
||||||
</nav-bar>
|
</nav-bar>
|
||||||
|
|
||||||
|
<cb-empty v-if="!loading && listData.length === 0"></cb-empty>
|
||||||
|
|
||||||
<view class="address-list">
|
<view class="address-list">
|
||||||
<uni-swipe-action>
|
<uni-swipe-action>
|
||||||
<uni-swipe-action-item v-for="item in listData" :key="item.id">
|
<uni-swipe-action-item v-for="item in listData" :key="item.id">
|
||||||
|
|||||||
Reference in New Issue
Block a user