Skip to content

Commit faaa8d6

Browse files
committed
perf: tabbar
1 parent 2e4b173 commit faaa8d6

2 files changed

Lines changed: 264 additions & 255 deletions

File tree

‎pages/template/tabbar/tabbar.vue‎

Lines changed: 57 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,61 @@
2121
<script>
2222
import mediaList from '@/components/tab-nvue/mediaList.vue';
2323
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
24+
25+
const tpl = {
26+
data0: {
27+
"datetime": "40分钟前",
28+
"article_type": 0,
29+
"title": "uni-app行业峰会频频亮相,开发者反响热烈!",
30+
"source": "DCloud",
31+
"comment_count": 639
32+
},
33+
data1: {
34+
"datetime": "一天前",
35+
"article_type": 1,
36+
"title": "DCloud完成B2轮融资,uni-app震撼发布!",
37+
"image_url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/shuijiao.jpg?imageView2/3/w/200/h/100/q/90",
38+
"source": "DCloud",
39+
"comment_count": 11395
40+
},
41+
data2: {
42+
"datetime": "一天前",
43+
"article_type": 2,
44+
"title": "中国技术界小奇迹:HBuilder开发者突破200万",
45+
"image_url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/muwu.jpg?imageView2/3/w/200/h/100/q/90",
46+
"source": "DCloud",
47+
"comment_count": 11395
48+
},
49+
data3: {
50+
"article_type": 3,
51+
"image_list": [{
52+
"url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/cbd.jpg?imageView2/3/w/200/h/100/q/90",
53+
"width": 563,
54+
"height": 316
55+
}, {
56+
"url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/muwu.jpg?imageView2/3/w/200/h/100/q/90",
57+
"width": 641,
58+
"height": 360
59+
}, {
60+
"url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/shuijiao.jpg?imageView2/3/w/200/h/100/q/90",
61+
"width": 640,
62+
"height": 360
63+
}],
64+
"datetime": "5分钟前",
65+
"title": "uni-app 支持使用 npm 安装第三方包,生态更趋丰富",
66+
"source": "DCloud",
67+
"comment_count": 11
68+
},
69+
data4: {
70+
"datetime": "2小时前",
71+
"article_type": 4,
72+
"title": "uni-app 支持原生小程序自定义组件,更开放、更自由",
73+
"image_url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/cbd.jpg?imageView2/3/w/200/h/100/q/90",
74+
"source": "DCloud",
75+
"comment_count": 69
76+
}
77+
};
78+
2479
export default {
2580
components: {
2681
mediaList,
@@ -37,57 +92,6 @@
3792
isClickChange: false,
3893
tabIndex: 0,
3994
newsitems: [],
40-
data0: {
41-
"datetime": "40分钟前",
42-
"article_type": 0,
43-
"title": "uni-app行业峰会频频亮相,开发者反响热烈!",
44-
"source": "DCloud",
45-
"comment_count": 639
46-
},
47-
data1: {
48-
"datetime": "一天前",
49-
"article_type": 1,
50-
"title": "DCloud完成B2轮融资,uni-app震撼发布!",
51-
"image_url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/shuijiao.jpg?imageView2/3/w/200/h/100/q/90",
52-
"source": "DCloud",
53-
"comment_count": 11395
54-
},
55-
data2: {
56-
"datetime": "一天前",
57-
"article_type": 2,
58-
"title": "中国技术界小奇迹:HBuilder开发者突破200万",
59-
"image_url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/muwu.jpg?imageView2/3/w/200/h/100/q/90",
60-
"source": "DCloud",
61-
"comment_count": 11395
62-
},
63-
data4: {
64-
"datetime": "2小时前",
65-
"article_type": 4,
66-
"title": "uni-app 支持原生小程序自定义组件,更开放、更自由",
67-
"image_url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/cbd.jpg?imageView2/3/w/200/h/100/q/90",
68-
"source": "DCloud",
69-
"comment_count": 69
70-
},
71-
data3: {
72-
"article_type": 3,
73-
"image_list": [{
74-
"url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/cbd.jpg?imageView2/3/w/200/h/100/q/90",
75-
"width": 563,
76-
"height": 316
77-
}, {
78-
"url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/muwu.jpg?imageView2/3/w/200/h/100/q/90",
79-
"width": 641,
80-
"height": 360
81-
}, {
82-
"url": "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/shuijiao.jpg?imageView2/3/w/200/h/100/q/90",
83-
"width": 640,
84-
"height": 360
85-
}],
86-
"datetime": "5分钟前",
87-
"title": "uni-app 支持使用 npm 安装第三方包,生态更趋丰富",
88-
"source": "DCloud",
89-
"comment_count": 11
90-
},
9195
tabBars: [{
9296
name: '关注',
9397
id: 'guanzhu'
@@ -209,7 +213,7 @@
209213
data: []
210214
};
211215
for (let j = 1; j <= 10; j++) {
212-
aryItem.data.push(this['data' + Math.floor(Math.random() * 5)]);
216+
aryItem.data.push(tpl['data' + Math.floor(Math.random() * 5)]);
213217
}
214218
ary.push(aryItem);
215219
}
@@ -224,5 +228,6 @@
224228
.swiper-tab-list {
225229
display: inline-block;
226230
}
231+
227232
/* #endif */
228233
</style>

0 commit comments

Comments
 (0)