v1.0
This commit is contained in:
11
uni_modules/uv-empty/changelog.md
Normal file
11
uni_modules/uv-empty/changelog.md
Normal file
@ -0,0 +1,11 @@
|
||||
## 1.0.4(2023-08-04)
|
||||
1. icon支持base64图片
|
||||
## 1.0.3(2023-07-17)
|
||||
1. 修复 uv-empty 恢复设置mode属性的内置图标
|
||||
## 1.0.2(2023-07-03)
|
||||
去除插槽判断,避免某些平台不显示的BUG
|
||||
## 1.0.1(2023-05-16)
|
||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
||||
2. 优化部分功能
|
||||
## 1.0.0(2023-05-10)
|
||||
uv-empty 内容为空
|
60
uni_modules/uv-empty/components/uv-empty/props.js
Normal file
60
uni_modules/uv-empty/components/uv-empty/props.js
Normal file
@ -0,0 +1,60 @@
|
||||
export default {
|
||||
props: {
|
||||
// 内置图标名称,或图片路径,建议绝对路径
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 提示文字
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 文字颜色
|
||||
textColor: {
|
||||
type: String,
|
||||
default: '#c0c4cc'
|
||||
},
|
||||
// 文字大小
|
||||
textSize: {
|
||||
type: [String, Number],
|
||||
default: 14
|
||||
},
|
||||
// 图标的颜色
|
||||
iconColor: {
|
||||
type: String,
|
||||
default: '#c0c4cc'
|
||||
},
|
||||
// 图标的大小
|
||||
iconSize: {
|
||||
type: [String, Number],
|
||||
default: 90
|
||||
},
|
||||
// 选择预置的图标类型
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'data'
|
||||
},
|
||||
// 图标宽度,单位px
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: 160
|
||||
},
|
||||
// 图标高度,单位px
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: 160
|
||||
},
|
||||
// 是否显示组件
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 组件距离上一个元素之间的距离,默认px单位
|
||||
marginTop: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
},
|
||||
...uni.$uv?.props?.empty
|
||||
}
|
||||
}
|
129
uni_modules/uv-empty/components/uv-empty/uv-empty.vue
Normal file
129
uni_modules/uv-empty/components/uv-empty/uv-empty.vue
Normal file
@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<view
|
||||
class="uv-empty"
|
||||
:style="[emptyStyle]"
|
||||
v-if="show"
|
||||
>
|
||||
<uv-icon
|
||||
v-if="!isImg"
|
||||
:name="mode === 'message' ? 'chat' : `empty-${mode}`"
|
||||
:size="iconSize"
|
||||
:color="iconColor"
|
||||
margin-top="14"
|
||||
></uv-icon>
|
||||
<image
|
||||
v-else
|
||||
:style="{
|
||||
width: $uv.addUnit(width),
|
||||
height: $uv.addUnit(height)
|
||||
}"
|
||||
:src="icon"
|
||||
mode="widthFix"
|
||||
></image>
|
||||
<text
|
||||
class="uv-empty__text"
|
||||
:style="[textStyle]"
|
||||
>{{ text ? text : icons[mode] }}</text>
|
||||
<view class="uv-empty__wrap">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
||||
import props from './props.js';
|
||||
/**
|
||||
* empty 内容为空
|
||||
* @description 该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
|
||||
* @tutorial https://www.uvui.cn/components/empty.html
|
||||
* @property {String} icon 内置图标名称,或图片路径,建议绝对路径
|
||||
* @property {String} text 提示文字
|
||||
* @property {String} textColor 文字颜色 (默认 '#c0c4cc' )
|
||||
* @property {String | Number} textSize 文字大小 (默认 14 )
|
||||
* @property {String} iconColor 图标的颜色 (默认 '#c0c4cc' )
|
||||
* @property {String | Number} iconSize 图标的大小 (默认 90 )
|
||||
* @property {String} mode 选择预置的图标类型 (默认 'data' )
|
||||
* @property {String | Number} width 图标宽度,单位px (默认 160 )
|
||||
* @property {String | Number} height 图标高度,单位px (默认 160 )
|
||||
* @property {Boolean} show 是否显示组件 (默认 true )
|
||||
* @property {String | Number} marginTop 组件距离上一个元素之间的距离,默认px单位 (默认 0 )
|
||||
* @property {Object} customStyle 定义需要用到的外部样式
|
||||
*
|
||||
* @event {Function} click 点击组件时触发
|
||||
* @event {Function} close 点击关闭按钮时触发
|
||||
* @example <uv-empty text="所谓伊人,在水一方" mode="list"></uv-empty>
|
||||
*/
|
||||
export default {
|
||||
name: "uv-empty",
|
||||
mixins: [mpMixin, mixin, props],
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
car: '购物车为空',
|
||||
page: '页面不存在',
|
||||
search: '没有搜索结果',
|
||||
address: '没有收货地址',
|
||||
'wifi-off': '没有WiFi',
|
||||
order: '订单为空',
|
||||
coupon: '没有优惠券',
|
||||
favor: '暂无收藏',
|
||||
permission: '无权限',
|
||||
history: '无历史记录',
|
||||
news: '无新闻列表',
|
||||
message: '消息列表为空',
|
||||
list: '列表为空',
|
||||
data: '数据为空',
|
||||
comment: '暂无评论',
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 组件样式
|
||||
emptyStyle() {
|
||||
const style = {}
|
||||
style.marginTop = this.$uv.addUnit(this.marginTop)
|
||||
// 合并customStyle样式,此参数通过mixin中的props传递
|
||||
return this.$uv.deepMerge(this.$uv.addStyle(this.customStyle), style)
|
||||
},
|
||||
// 文本样式
|
||||
textStyle() {
|
||||
const style = {}
|
||||
style.color = this.textColor
|
||||
style.fontSize = this.$uv.addUnit(this.textSize)
|
||||
return style
|
||||
},
|
||||
// 判断icon是否图片路径
|
||||
isImg() {
|
||||
const isBase64 = this.icon.indexOf('data:') > -1 && this.icon.indexOf('base64') > -1;
|
||||
return this.icon.indexOf('/') !== -1 || isBase64;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
|
||||
$uv-empty-text-margin-top: 20rpx !default;
|
||||
$uv-empty-slot-margin-top: 20rpx !default;
|
||||
|
||||
.uv-empty {
|
||||
@include flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&__text {
|
||||
@include flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: $uv-empty-text-margin-top;
|
||||
}
|
||||
}
|
||||
|
||||
.uv-slot-wrap {
|
||||
@include flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: $uv-empty-slot-margin-top;
|
||||
}
|
||||
</style>
|
88
uni_modules/uv-empty/package.json
Normal file
88
uni_modules/uv-empty/package.json
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"id": "uv-empty",
|
||||
"displayName": "uv-empty 内容为空 全面兼容vue3+2、app、h5、小程序等多端",
|
||||
"version": "1.0.4",
|
||||
"description": "该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个 没有内容 的场景, 我们精心挑选了十几个场景的图标,方便您使用。",
|
||||
"keywords": [
|
||||
"empty",
|
||||
"uvui",
|
||||
"uv-ui",
|
||||
"空数据",
|
||||
"暂无数据"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "component-vue",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "插件不采集任何数据",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uv-ui-tools",
|
||||
"uv-icon"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y",
|
||||
"钉钉": "u",
|
||||
"快手": "u",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
uni_modules/uv-empty/readme.md
Normal file
19
uni_modules/uv-empty/readme.md
Normal file
@ -0,0 +1,19 @@
|
||||
## Empty 内容为空
|
||||
|
||||
> **组件名:uv-empty**
|
||||
|
||||
该组件用于需要加载内容,但是加载的第一页数据就为空,提示一个"没有内容"的场景, 我们精心挑选了十几个场景的图标,方便您使用。
|
||||
|
||||
# <a href="https://www.uvui.cn/components/empty.html" target="_blank">查看文档</a>
|
||||
|
||||
## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui) <small>(请不要 下载插件ZIP)</small>
|
||||
|
||||
### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
||||
|
||||
<a href="https://ext.dcloud.net.cn/plugin?name=uv-ui" target="_blank">
|
||||
|
||||

|
||||
|
||||
</a>
|
||||
|
||||
#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
Reference in New Issue
Block a user