fix(harmony): 鸿蒙环境下隐藏 loading-cover 和 mescroll 上拉加载动画
- 鸿蒙 ArkUI 渲染引擎对 Vue 响应式条件渲染(v-if/v-show)支持不完善 - 导致 loading-cover 调用 hide() 后仍显示 - 导致 mescroll-uni 加载完成后 upLoadType 已变为0但视图不更新 - 通过条件编译 #ifdef MP-HARMONY 在鸿蒙环境下跳过这些组件的渲染 - 避免用户界面一直处于加载状态
This commit is contained in:
@@ -1,115 +1,120 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="loading-layer" v-if="isShow">
|
<!-- #ifdef MP-HARMONY -->
|
||||||
<view class="loading-anim" v-if="themeStyle">
|
<view></view>
|
||||||
<view class="box item">
|
<!-- #endif -->
|
||||||
<view class="border out item" :style="{'border-left-color':themeStyle.main_color, 'border-top-color':themeStyle.main_color}"></view>
|
<!-- #ifndef MP-HARMONY -->
|
||||||
</view>
|
<view class="loading-layer" v-if="isShow">
|
||||||
</view>
|
<view class="loading-anim" v-if="themeStyle">
|
||||||
</view>
|
<view class="box item">
|
||||||
</template>
|
<view class="border out item" :style="{'border-left-color':themeStyle.main_color, 'border-top-color':themeStyle.main_color}"></view>
|
||||||
|
</view>
|
||||||
<script>
|
</view>
|
||||||
export default {
|
</view>
|
||||||
name: 'loading-cover',
|
<!-- #endif -->
|
||||||
props: {
|
</template>
|
||||||
initShow: {
|
|
||||||
type: Boolean,
|
<script>
|
||||||
default: true
|
export default {
|
||||||
}
|
name: 'loading-cover',
|
||||||
},
|
props: {
|
||||||
data() {
|
initShow: {
|
||||||
return {
|
type: Boolean,
|
||||||
isShow: true
|
default: true
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
components: {},
|
data() {
|
||||||
created() {
|
return {
|
||||||
this.isShow = this.initShow;
|
isShow: true
|
||||||
},
|
};
|
||||||
methods: {
|
},
|
||||||
show() {
|
components: {},
|
||||||
this.isShow = true;
|
created() {
|
||||||
},
|
this.isShow = this.initShow;
|
||||||
hide() {
|
},
|
||||||
this.isShow = false;
|
methods: {
|
||||||
}
|
show() {
|
||||||
}
|
this.isShow = true;
|
||||||
};
|
},
|
||||||
</script>
|
hide() {
|
||||||
|
this.isShow = false;
|
||||||
<style lang="scss">
|
}
|
||||||
@keyframes spin {
|
}
|
||||||
from {
|
};
|
||||||
transform: rotate(0deg);
|
</script>
|
||||||
}
|
|
||||||
|
<style lang="scss">
|
||||||
to {
|
@keyframes spin {
|
||||||
transform: rotate(360deg);
|
from {
|
||||||
}
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
.loading-layer {
|
|
||||||
width: 100%;
|
to {
|
||||||
height: 100%;
|
transform: rotate(360deg);
|
||||||
position: fixed;
|
}
|
||||||
top: 0;
|
}
|
||||||
left: 0;
|
.loading-layer {
|
||||||
z-index: 997;
|
width: 100%;
|
||||||
background: #f8f8f8;
|
height: 100%;
|
||||||
}
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
.loading-anim {
|
left: 0;
|
||||||
position: absolute;
|
z-index: 997;
|
||||||
left: 50%;
|
background: #f8f8f8;
|
||||||
top: 40%;
|
}
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
.loading-anim {
|
||||||
|
position: absolute;
|
||||||
.loading-anim > .item {
|
left: 50%;
|
||||||
position: relative;
|
top: 40%;
|
||||||
width: 70rpx;
|
transform: translate(-50%, -50%);
|
||||||
height: 70rpx;
|
}
|
||||||
perspective: 1600rpx;
|
|
||||||
transform-style: preserve-3d;
|
.loading-anim > .item {
|
||||||
transition: all 0.2s ease-out;
|
position: relative;
|
||||||
}
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
.loading-anim .border {
|
perspective: 1600rpx;
|
||||||
position: absolute;
|
transform-style: preserve-3d;
|
||||||
border-radius: 50%;
|
transition: all 0.2s ease-out;
|
||||||
border: 6rpx solid;
|
}
|
||||||
}
|
|
||||||
|
.loading-anim .border {
|
||||||
.loading-anim .out {
|
position: absolute;
|
||||||
top: 15%;
|
border-radius: 50%;
|
||||||
left: 15%;
|
border: 6rpx solid;
|
||||||
width: 70%;
|
}
|
||||||
height: 70%;
|
|
||||||
border-left-color: #FF4646;
|
.loading-anim .out {
|
||||||
border-right-color: #C5C5C5 !important;
|
top: 15%;
|
||||||
// border-right-color: rgba($color: #000000, $alpha: 0) !important;
|
left: 15%;
|
||||||
border-top-color: #FF4646 ;
|
width: 70%;
|
||||||
border-bottom-color: #C5C5C5 !important;
|
height: 70%;
|
||||||
// border-bottom-color: rgba($color: #000000, $alpha: 0) !important;
|
border-left-color: #FF4646;
|
||||||
animation: spin 0.6s linear normal infinite;
|
border-right-color: #C5C5C5 !important;
|
||||||
}
|
// border-right-color: rgba($color: #000000, $alpha: 0) !important;
|
||||||
|
border-top-color: #FF4646 ;
|
||||||
.loading-anim .in {
|
border-bottom-color: #C5C5C5 !important;
|
||||||
top: 25%;
|
// border-bottom-color: rgba($color: #000000, $alpha: 0) !important;
|
||||||
left: 25%;
|
animation: spin 0.6s linear normal infinite;
|
||||||
width: 50%;
|
}
|
||||||
height: 50%;
|
|
||||||
border-top-color: transparent !important;
|
.loading-anim .in {
|
||||||
border-bottom-color: transparent !important;
|
top: 25%;
|
||||||
animation: spin 0.8s linear infinite;
|
left: 25%;
|
||||||
}
|
width: 50%;
|
||||||
|
height: 50%;
|
||||||
.loading-anim .mid {
|
border-top-color: transparent !important;
|
||||||
top: 40%;
|
border-bottom-color: transparent !important;
|
||||||
left: 40%;
|
animation: spin 0.8s linear infinite;
|
||||||
width: 20%;
|
}
|
||||||
height: 20%;
|
|
||||||
border-left-color: transparent;
|
.loading-anim .mid {
|
||||||
border-right-color: transparent;
|
top: 40%;
|
||||||
animation: spin 0.6s linear infinite;
|
left: 40%;
|
||||||
}
|
width: 20%;
|
||||||
</style>
|
height: 20%;
|
||||||
|
border-left-color: transparent;
|
||||||
|
border-right-color: transparent;
|
||||||
|
animation: spin 0.6s linear infinite;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<!-- <mescroll-empty v-if="isShowEmpty" :option="mescroll.optUp.empty" @emptyclick="emptyClick"></mescroll-empty> -->
|
<!-- <mescroll-empty v-if="isShowEmpty" :option="mescroll.optUp.empty" @emptyclick="emptyClick"></mescroll-empty> -->
|
||||||
|
|
||||||
<!-- 上拉加载区域 (下拉刷新时不显示, 支付宝小程序子组件传参给子子组件仍报单项数据流的异常,暂时不通过mescroll-up组件实现)-->
|
<!-- 上拉加载区域 (下拉刷新时不显示, 支付宝小程序子组件传参给子子组件仍报单项数据流的异常,暂时不通过mescroll-up组件实现)-->
|
||||||
|
<!-- #ifndef MP-HARMONY -->
|
||||||
<!-- <mescroll-up v-if="mescroll.optUp.use && !isDownLoading" :option="mescroll.optUp" :type="upLoadType"></mescroll-up> -->
|
<!-- <mescroll-up v-if="mescroll.optUp.use && !isDownLoading" :option="mescroll.optUp" :type="upLoadType"></mescroll-up> -->
|
||||||
<view v-if="mescroll.optUp.use && !isDownLoading" class="mescroll-upwarp">
|
<view v-if="mescroll.optUp.use && !isDownLoading" class="mescroll-upwarp">
|
||||||
<!-- 加载中 (此处不能用v-if,否则android小程序快速上拉可能会不断触发上拉回调) -->
|
<!-- 加载中 (此处不能用v-if,否则android小程序快速上拉可能会不断触发上拉回调) -->
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
<!-- 无数据 -->
|
<!-- 无数据 -->
|
||||||
<view v-if="upLoadType === 2" class="upwarp-nodata">{{ mescroll.optUp.textNoMore }}</view>
|
<view v-if="upLoadType === 2" class="upwarp-nodata">{{ mescroll.optUp.textNoMore }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user