-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
404 changed files
with
8,821 additions
and
50,134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* 下拉刷新区域 */ | ||
.mescroll-downwarp { | ||
position: absolute; | ||
top: -100%; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
text-align: center; | ||
} | ||
|
||
/* 下拉刷新--内容区,定位于区域底部 */ | ||
.mescroll-downwarp .downwarp-content { | ||
position: absolute; | ||
left: 0; | ||
bottom: 0; | ||
width: 100%; | ||
min-height: 60rpx; | ||
padding: 20rpx 0; | ||
text-align: center; | ||
} | ||
.mescroll-downwarp .downwarp-content image{ | ||
width: 140rpx; | ||
height: 140rpx; | ||
margin-bottom: 10rpx; | ||
} | ||
|
||
/* 下拉刷新--提示文本 */ | ||
.mescroll-downwarp .downwarp-tip { | ||
display: inline-block; | ||
font-size: 28rpx; | ||
vertical-align: middle; | ||
margin-left: 16rpx; | ||
/* color: gray; 已在style设置color,此处删去*/ | ||
} | ||
|
||
/* 下拉刷新--旋转进度条 */ | ||
.mescroll-downwarp .downwarp-progress { | ||
display: inline-block; | ||
width: 32rpx; | ||
height: 32rpx; | ||
border-radius: 50%; | ||
border: 2rpx solid gray; | ||
border-bottom-color: transparent !important; /*已在style设置border-color,此处需加 !important*/ | ||
vertical-align: middle; | ||
} | ||
|
||
/* 旋转动画 */ | ||
.mescroll-downwarp .mescroll-rotate { | ||
animation: mescrollDownRotate 0.6s linear infinite; | ||
} | ||
|
||
@keyframes mescrollDownRotate { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
|
||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!-- 下拉刷新区域 --> | ||
<template> | ||
<view v-if="mOption.use" class="mescroll-downwarp" :style="{'background-color':mOption.bgColor,'color':mOption.textColor}"> | ||
<view class="downwarp-content"> | ||
<view class="downwarp-progress" :class="{'mescroll-rotate': isDownLoading}" :style="{'border-color':mOption.textColor, 'transform':downRotate}"></view> | ||
<view class="downwarp-tip">{{downText}}</view> | ||
</view> | ||
</view> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
option: Object , // down的配置项 | ||
type: Number, // 下拉状态(inOffset:1, outOffset:2, showLoading:3, endDownScroll:4) | ||
rate: Number // 下拉比率 (inOffset: rate<1; outOffset: rate>=1) | ||
}, | ||
computed: { | ||
// 支付宝小程序需写成计算属性,prop定义default仍报错 | ||
mOption(){ | ||
return this.option || {} | ||
}, | ||
// 是否在加载中 | ||
isDownLoading(){ | ||
return this.type === 3 | ||
}, | ||
// 旋转的角度 | ||
downRotate(){ | ||
return 'rotate(' + 360 * this.rate + 'deg)' | ||
}, | ||
// 文本提示 | ||
downText(){ | ||
switch (this.type){ | ||
case 1: return this.mOption.textInOffset; | ||
case 2: return this.mOption.textOutOffset; | ||
case 3: return this.mOption.textLoading; | ||
case 4: return this.mOption.textLoading; | ||
default: return this.mOption.textInOffset; | ||
} | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
@import "./mescroll-down.css"; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<!--空布局 | ||
|
||
可作为独立的组件, 不使用mescroll的页面也能单独引入, 以便APP全局统一管理: | ||
import MescrollEmpty from '@/components/mescroll-uni/components/mescroll-empty.vue'; | ||
<mescroll-empty v-if="isShowEmpty" :option="optEmpty" @emptyclick="emptyClick"></mescroll-empty> | ||
|
||
--> | ||
<template> | ||
<view class="mescroll-empty" :class="{ 'empty-fixed': option.fixed }" :style="{ 'z-index': option.zIndex, top: option.top }"> | ||
<view> <image v-if="icon" class="empty-icon" :src="icon" mode="widthFix" /> </view> | ||
<view v-if="tip" class="empty-tip">{{ tip }}</view> | ||
<view v-if="option.btnText" class="empty-btn" @click="emptyClick">{{ option.btnText }}</view> | ||
</view> | ||
</template> | ||
|
||
<script> | ||
// 引入全局配置 | ||
import GlobalOption from './../mescroll-uni-option.js'; | ||
export default { | ||
props: { | ||
// empty的配置项: 默认为GlobalOption.up.empty | ||
option: { | ||
type: Object, | ||
default() { | ||
return {}; | ||
} | ||
} | ||
}, | ||
// 使用computed获取配置,用于支持option的动态配置 | ||
computed: { | ||
// 图标 | ||
icon() { | ||
return this.option.icon == null ? GlobalOption.up.empty.icon : this.option.icon; // 此处不使用短路求值, 用于支持传空串不显示图标 | ||
}, | ||
// 文本提示 | ||
tip() { | ||
return this.option.tip == null ? GlobalOption.up.empty.tip : this.option.tip; // 此处不使用短路求值, 用于支持传空串不显示文本提示 | ||
} | ||
}, | ||
methods: { | ||
// 点击按钮 | ||
emptyClick() { | ||
this.$emit('emptyclick'); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
/* 无任何数据的空布局 */ | ||
.mescroll-empty { | ||
box-sizing: border-box; | ||
width: 100%; | ||
padding: 100rpx 50rpx; | ||
text-align: center; | ||
} | ||
|
||
.mescroll-empty.empty-fixed { | ||
z-index: 99; | ||
position: absolute; /*transform会使fixed失效,最终会降级为absolute */ | ||
top: 100rpx; | ||
left: 0; | ||
} | ||
|
||
.mescroll-empty .empty-icon { | ||
width: 280rpx; | ||
height: 280rpx; | ||
} | ||
|
||
.mescroll-empty .empty-tip { | ||
margin-top: 20rpx; | ||
font-size: 24rpx; | ||
color: gray; | ||
} | ||
|
||
.mescroll-empty .empty-btn { | ||
display: inline-block; | ||
margin-top: 40rpx; | ||
min-width: 200rpx; | ||
padding: 18rpx; | ||
font-size: 28rpx; | ||
border: 1rpx solid #e04b28; | ||
border-radius: 60rpx; | ||
color: #e04b28; | ||
} | ||
|
||
.mescroll-empty .empty-btn:active { | ||
opacity: 0.75; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!-- 回到顶部的按钮 --> | ||
<template> | ||
<image | ||
v-if="mOption.src" | ||
class="mescroll-totop" | ||
:class="[value ? 'mescroll-totop-in' : 'mescroll-totop-out', {'mescroll-totop-safearea': mOption.safearea}]" | ||
:style="{'z-index':mOption.zIndex, 'left': left, 'right': right, 'bottom':addUnit(mOption.bottom), 'width':addUnit(mOption.width), 'border-radius':addUnit(mOption.radius)}" | ||
:src="mOption.src" | ||
mode="widthFix" | ||
@click="toTopClick" | ||
/> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
// up.toTop的配置项 | ||
option: Object, | ||
// 是否显示 | ||
value: false | ||
}, | ||
computed: { | ||
// 支付宝小程序需写成计算属性,prop定义default仍报错 | ||
mOption(){ | ||
return this.option || {} | ||
}, | ||
// 优先显示左边 | ||
left(){ | ||
return this.mOption.left ? this.addUnit(this.mOption.left) : 'auto'; | ||
}, | ||
// 右边距离 (优先显示左边) | ||
right() { | ||
return this.mOption.left ? 'auto' : this.addUnit(this.mOption.right); | ||
} | ||
}, | ||
methods: { | ||
addUnit(num){ | ||
if(!num) return 0; | ||
if(typeof num === 'number') return num + 'rpx'; | ||
return num | ||
}, | ||
toTopClick() { | ||
this.$emit('input', false); // 使v-model生效 | ||
this.$emit('click'); // 派发点击事件 | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
/* 回到顶部的按钮 */ | ||
.mescroll-totop { | ||
z-index: 9990; | ||
position: fixed !important; /* 加上important避免编译到H5,在多mescroll中定位失效 */ | ||
right: 20rpx; | ||
bottom: 120rpx; | ||
width: 72rpx; | ||
height: auto; | ||
border-radius: 50%; | ||
opacity: 0; | ||
transition: opacity 0.5s; /* 过渡 */ | ||
margin-bottom: var(--window-bottom); /* css变量 */ | ||
} | ||
|
||
/* 适配 iPhoneX */ | ||
@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) { | ||
.mescroll-totop-safearea { | ||
margin-bottom: calc(var(--window-bottom) + constant(safe-area-inset-bottom)); /* window-bottom + 适配 iPhoneX */ | ||
margin-bottom: calc(var(--window-bottom) + env(safe-area-inset-bottom)); | ||
} | ||
} | ||
|
||
/* 显示 -- 淡入 */ | ||
.mescroll-totop-in { | ||
opacity: 1; | ||
} | ||
|
||
/* 隐藏 -- 淡出且不接收事件*/ | ||
.mescroll-totop-out { | ||
opacity: 0; | ||
pointer-events: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* 上拉加载区域 */ | ||
.mescroll-upwarp { | ||
box-sizing: border-box; | ||
min-height: 110rpx; | ||
padding: 30rpx 0; | ||
text-align: center; | ||
clear: both; | ||
} | ||
|
||
/*提示文本 */ | ||
.mescroll-upwarp .upwarp-tip, | ||
.mescroll-upwarp .upwarp-nodata { | ||
display: inline-block; | ||
font-size: 28rpx; | ||
vertical-align: middle; | ||
/* color: gray; 已在style设置color,此处删去*/ | ||
} | ||
|
||
.mescroll-upwarp .upwarp-tip { | ||
margin-left: 16rpx; | ||
} | ||
|
||
/*旋转进度条 */ | ||
.mescroll-upwarp .upwarp-progress { | ||
display: inline-block; | ||
width: 32rpx; | ||
height: 32rpx; | ||
border-radius: 50%; | ||
border: 2rpx solid gray; | ||
border-bottom-color: transparent !important; /*已在style设置border-color,此处需加 !important*/ | ||
vertical-align: middle; | ||
} | ||
|
||
/* 旋转动画 */ | ||
.mescroll-upwarp .mescroll-rotate { | ||
animation: mescrollUpRotate 0.6s linear infinite; | ||
} | ||
|
||
@keyframes mescrollUpRotate { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
|
||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- 上拉加载区域 --> | ||
<template> | ||
<view class="mescroll-upwarp" :style="{'background-color':mOption.bgColor,'color':mOption.textColor}"> | ||
<!-- 加载中 (此处不能用v-if,否则android小程序快速上拉可能会不断触发上拉回调) --> | ||
<view v-show="isUpLoading"> | ||
<view class="upwarp-progress mescroll-rotate" :style="{'border-color':mOption.textColor}"></view> | ||
<view class="upwarp-tip">{{ mOption.textLoading }}</view> | ||
</view> | ||
<!-- 无数据 --> | ||
<view v-if="isUpNoMore" class="upwarp-nodata">{{ mOption.textNoMore }}</view> | ||
</view> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
option: Object, // up的配置项 | ||
type: Number // 上拉加载的状态:0(loading前),1(loading中),2(没有更多了) | ||
}, | ||
computed: { | ||
// 支付宝小程序需写成计算属性,prop定义default仍报错 | ||
mOption() { | ||
return this.option || {}; | ||
}, | ||
// 加载中 | ||
isUpLoading() { | ||
return this.type === 1; | ||
}, | ||
// 没有更多了 | ||
isUpNoMore() { | ||
return this.type === 2; | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
@import './mescroll-up.css'; | ||
</style> |
Oops, something went wrong.