Skip to content

Commit

Permalink
v2.4.7-优化代码结构
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileZXLee committed Oct 25, 2022
1 parent 84e05f2 commit 818a7fc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export default {
nSafeAreaBottomHeight() {
return this.safeAreaInsetBottom ? this.safeAreaBottom : 0;
},
nChatRecordRotateStyle() {
return this.useChatRecordMode ? { transform: this.nIsFirstPageAndNoMore ? 'rotate(0deg)' : 'rotate(180deg)' } : {};
},
finalNvueListIs() {
if (this.usePageScroll) return 'view';
const nvueListIsLowerCase = this.nvueListIs.toLowerCase();
Expand Down Expand Up @@ -185,7 +188,7 @@ export default {
}
const stackCount = this.refresherRevealStackCount;
if (height === 0 && checkStack) {
this.refresherRevealStackCount--;
this.refresherRevealStackCount --;
if (stackCount > 1) return;
this.refresherEndTimeout = setTimeout(() => {
this.refresherStatus = Enum.Refresher.Default;
Expand Down Expand Up @@ -233,10 +236,7 @@ export default {
this.$nextTick(()=>{
this._getNodeClientRect('.zp-n-list').then(node => {
if (node) {
const nodeWidth = node[0].width;
if (nodeWidth) {
this.nRefresherWidth = nodeWidth;
}
this.nRefresherWidth = node[0].width ? node[0].width : this.nRefresherWidth;
}
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,7 @@ export default {
this._startLoading(true);
this.refresherTriggered = true;
if(this.reloadWhenRefresh && isUserPullDown){
if (this.useChatRecordMode) {
this._onLoadingMore('click')
} else {
this._reload(false, false, isUserPullDown);
}
this.useChatRecordMode ? this._onLoadingMore('click') : this._reload(false, false, isUserPullDown);
}
},
//自定义下拉刷新被复位
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,7 @@ export default {
return new Promise((resolve, reject) => {
if (ref) {
weexDom.getComponentRect(ref, option => {
if (option && option.result) {
resolve([option.size]);
} else {
resolve(false);
}
resolve(option && option.result ? [option.size] : false);
})
} else {
resolve(false);
Expand All @@ -490,11 +486,7 @@ export default {
inThis = false;
//#endif
let res = inThis ? uni.createSelectorQuery().in(this) : uni.createSelectorQuery();
if (scrollOffset) {
res.select(select).scrollOffset();
} else {
res.select(select).boundingClientRect();
}
scrollOffset ? res.select(select).scrollOffset() : res.select(select).boundingClientRect();
return new Promise((resolve, reject) => {
res.exec(data => {
resolve((data && data != '' && data != undefined && data.length) ? data : false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ by ZXLee
<view v-if="$slots.left" class="zp-page-left">
<slot name="left" />
</view>
<component :is="finalNvueListIs" ref="zp-n-list" :id="nvueListId" :style="[{'flex': 1,'top':isIos?'0px':'-1px'},usePageScroll?scrollViewStyle:{},useChatRecordMode ? {transform: nIsFirstPageAndNoMore?'rotate(0deg)':'rotate(180deg)'}:{}]" :alwaysScrollableVertical="true"
<component :is="finalNvueListIs" ref="zp-n-list" :id="nvueListId" :style="[{'flex': 1,'top':isIos?'0px':'-1px'},usePageScroll?scrollViewStyle:{},nChatRecordRotateStyle]" :alwaysScrollableVertical="true"
:fixFreezing="nFixFreezing" :show-scrollbar="showScrollbar&&!useChatRecordMode" :loadmoreoffset="finalLowerThreshold" :enable-back-to-top="enableBackToTop"
:scrollable="scrollable&&scrollEnable&&(refresherCompleteScrollable?true:refresherStatus!==R.Complete)" :bounce="nvueBounce" :column-count="nWaterfallColumnCount" :column-width="nWaterfallColumnWidth"
:column-gap="nWaterfallColumnGap" :left-gap="nWaterfallLeftGap" :right-gap="nWaterfallRightGap" :pagingEnabled="nvuePagingEnabled" :offset-accuracy="offsetAccuracy"
Expand Down Expand Up @@ -213,11 +213,11 @@ by ZXLee
<slot />
</template>
<!-- 全屏Loading -->
<component :is="nViewIs" v-if="showLoading&&$slots.loading&&!loadingFullFixed" :class="{'z-paging-content-fixed':usePageScroll}" style="flex: 1;" :style="[useChatRecordMode ? {transform: nIsFirstPageAndNoMore?'rotate(0deg)':'rotate(180deg)'}:{}]">
<component :is="nViewIs" v-if="showLoading&&$slots.loading&&!loadingFullFixed" :class="{'z-paging-content-fixed':usePageScroll}" style="flex: 1;" :style="[nChatRecordRotateStyle]">
<slot name="loading" />
</component>
<!-- 空数据图 -->
<component :is="nViewIs" v-if="showEmpty" :class="{'z-paging-content-fixed':usePageScroll}" :style="[{flex:emptyViewCenter?1:0},emptyViewSuperStyle,useChatRecordMode?{transform: nIsFirstPageAndNoMore?'rotate(0deg)':'rotate(180deg)'}:{}]">
<component :is="nViewIs" v-if="showEmpty" :class="{'z-paging-content-fixed':usePageScroll}" :style="[{flex:emptyViewCenter?1:0},emptyViewSuperStyle,nChatRecordRotateStyle]">
<view :class="{'zp-empty-view':true,'zp-empty-view-center':emptyViewCenter}">
<slot v-if="$slots.empty" name="empty" />
<z-paging-empty-view v-else :emptyViewImg="finalEmptyViewImg" :emptyViewText="finalEmptyViewText" :showEmptyViewReload="finalShowEmptyViewReload"
Expand Down

0 comments on commit 818a7fc

Please sign in to comment.