提交 c2e5bb7a 编写于 作者: H hulinneil

Merge branch 'master' of https://github.com/dcloudio/uni-app

...@@ -817,4 +817,48 @@ radio-group label, checkbox-group label{ ...@@ -817,4 +817,48 @@ radio-group label, checkbox-group label{
line-height:1.6; line-height:1.6;
font-size:28upx; font-size:28upx;
height:150upx; height:150upx;
}
/* tab bar */
.uni-tab-bar {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
height: 100%;
}
.uni-tab-bar .list {
width: 750upx;
height: 100%;
}
.uni-swiper-tab {
width: 100%;
white-space: nowrap;
line-height: 100upx;
height: 100upx;
border-bottom: 1px solid #c8c7cc;
}
.swiper-tab-list {
font-size: 30upx;
width: 150upx;
display: inline-block;
text-align: center;
color: #555;
}
.uni-tab-bar .active {
color: #007AFF;
}
.uni-tab-bar .swiper-box {
flex: 1;
width: 100%;
height: calc(100% - 100upx);
}
.uni-tab-bar-loading{
padding:20upx 0;
} }
\ No newline at end of file
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
} }
.loading-text { .loading-text {
font-size: 15px; font-size: 28upx;
color: #777777; color: #777777;
} }
......
<template> <template>
<view class="index"> <view class="uni-tab-bar">
<scroll-view id="tab-bar" class="swiper-tab" scroll-x :scroll-left="scrollLeft"> <scroll-view id="tab-bar" class="uni-swiper-tab" scroll-x :scroll-left="scrollLeft">
<view v-for="(tab,index) in tabBars" :key="tab.id" :class="['swiper-tab-list',tabIndex==index ? 'active' : '']" <view v-for="(tab,index) in tabBars" :key="tab.id" :class="['swiper-tab-list',tabIndex==index ? 'active' : '']"
:id="tab.id" :data-current="index" @tap="tapTab">{{tab.name}}</view> :id="tab.id" :data-current="index" @tap="tapTab">{{tab.name}}</view>
</scroll-view> </scroll-view>
...@@ -10,22 +10,29 @@ ...@@ -10,22 +10,29 @@
<block v-for="(newsitem,index2) in tab.data" :key="index2"> <block v-for="(newsitem,index2) in tab.data" :key="index2">
<media-list :data="newsitem" @close="close(index1,index2)" @click="goDetail(newsitem)"></media-list> <media-list :data="newsitem" @close="close(index1,index2)" @click="goDetail(newsitem)"></media-list>
</block> </block>
<view class="loadmore"> <view class="uni-tab-bar-loading">
<text class="loadmore-text">{{tab.loadingText}}</text> <load-more :loadingType="tab.loadingType" :contentText="loadingText"></load-more>
</view> </view>
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
</template> </template>
<script> <script>
import mediaList from '@/components/tab-nvue/mediaList.vue' import mediaList from '@/components/tab-nvue/mediaList.vue';
import loadMore from '@/components/load-more.vue';
export default { export default {
components: { components: {
mediaList mediaList,
loadMore
}, },
data() { data() {
return { return {
loadingText: {
contentdown: "上拉显示更多",
contentrefresh: "正在加载...",
contentnomore: "没有更多数据了"
},
scrollLeft: 0, scrollLeft: 0,
isClickChange: false, isClickChange: false,
tabIndex: 0, tabIndex: 0,
...@@ -131,19 +138,20 @@ ...@@ -131,19 +138,20 @@
}) })
}, },
loadMore(e) { loadMore(e) {
this.newsitems[e].loadingType = 1;
setTimeout(() => { setTimeout(() => {
this.addData(e); this.addData(e);
}, 1000); }, 1200);
}, },
addData(e) { addData(e) {
console.log("加载更多...");
if (this.newsitems[e].data.length > 30) { if (this.newsitems[e].data.length > 30) {
this.newsitems[e].loadingText = '没有更多了'; this.newsitems[e].loadingType = 2;
return; return;
} }
for (let i = 1; i <= 10; i++) { for (let i = 1; i <= 10; i++) {
this.newsitems[e].data.push(this['data' + Math.floor(Math.random() * 5)]); this.newsitems[e].data.push(this['data' + Math.floor(Math.random() * 5)]);
} }
this.newsitems[e].loadingType = 1;
}, },
async changeTab(e) { async changeTab(e) {
let index = e.target.current; let index = e.target.current;
...@@ -197,7 +205,7 @@ ...@@ -197,7 +205,7 @@
let ary = []; let ary = [];
for (let i = 0, length = this.tabBars.length; i < length; i++) { for (let i = 0, length = this.tabBars.length; i < length; i++) {
let aryItem = { let aryItem = {
loadingText: "加载更多...", loadingType : 0,
data: [] data: []
}; };
for (let j = 1; j <= 10; j++) { for (let j = 1; j <= 10; j++) {
...@@ -212,60 +220,5 @@ ...@@ -212,60 +220,5 @@
</script> </script>
<style> <style>
page {
display: flex;
}
.index {
display: flex;
flex: 1;
flex-direction: column;
overflow: hidden;
height: 100%;
}
.list {
width: 750upx;
height: 100%;
}
.swiper-tab { </style>
width: 100%; \ No newline at end of file
white-space: nowrap;
line-height: 100upx;
height: 100upx;
border-bottom: 1px solid #c8c7cc;
}
.swiper-tab-list {
font-size: 30upx;
width: 150upx;
display: inline-block;
text-align: center;
color: #555;
}
.active {
color: #007AFF;
}
.swiper-box {
flex: 1;
width: 100%;
height: calc(100% - 100upx);
}
.loadmore {
height: 70upx;
width: 750upx;
flex-direction: column;
justify-content: center;
}
.loadmore-text {
font-size: 30upx;
text-align: center;
color: #999999;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册