Skip to content

Commit 319bf0e

Browse files
committed
fix(uni-ui): list 组件改为 nvue ,修复 segmented 点击报错的问题,
1 parent 69f993e commit 319bf0e

5 files changed

Lines changed: 17 additions & 91 deletions

File tree

components/uni-list/uni-list.vue

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<!-- #ifdef APP-VUE -->
2+
<!-- #ifndef APP-NVUE -->
33
<view class="uni-list">
44
<slot />
55
</view>
@@ -9,20 +9,8 @@
99
<slot />
1010
</list>
1111
<!-- #endif -->
12-
<!-- #ifdef H5 || MP-WEIXIN || MP-QQ -->
13-
<scroll-view class="uni-list" :enableBackToTop="enableBackToTop" :scroll-y="scrollY" @scrolltolower="loadMore" @touchstart="refresh.touchstart" @touchmove="refresh.touchmove" @touchend="refresh.touchend">
14-
<slot />
15-
</scroll-view>
16-
<!-- #endif -->
17-
<!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO -->
18-
<scroll-view class="uni-list" :scroll-y="scrollY" @scrolltolower="loadMore" @touchstart="ontouchstart" @touchmove="ontouchmove" @touchend="ontouchend">
19-
<slot />
20-
</scroll-view>
21-
<!-- #endif -->
2212
</template>
2313

24-
<script src="./uni-refresh.wxs" module="refresh" lang="wxs"></script>
25-
2614
<script>
2715
export default {
2816
name: 'UniList',
@@ -48,72 +36,10 @@
4836
},
4937
created() {
5038
this.firstChildAppend = false
51-
// #ifndef APP-NVUE
52-
this.pullDown = {
53-
threshold: 95,
54-
maxHeight: 200,
55-
callRefresh: 'onrefresh',
56-
callPullingDown: 'onpullingdown',
57-
refreshSelector: '.uni-refresh'
58-
};
59-
this.height = 0;
60-
this.canPullDown = false;
61-
this.refreshInstance = {};
62-
// #endif
6339
},
6440
methods: {
6541
loadMore(e) {
6642
this.$emit("scrolltolower");
67-
},
68-
ontouchstart(e) {
69-
if (!this.canPullDown) {
70-
return
71-
}
72-
73-
this.height = 0;
74-
this.touchStartY = e.touches[0].pageY || e.changedTouches[0].pageY;
75-
this._updateRefresh(0);
76-
this.refreshInstance.callMethod("onchange", true);
77-
},
78-
ontouchmove(e) {
79-
if (!this.canPullDown) {
80-
return
81-
}
82-
83-
var oldHeight = this.height;
84-
var endY = e.touches[0].pageY || e.changedTouches[0].pageY;
85-
var newHeight = endY - this.touchStartY;
86-
if (newHeight > this.pullDown.maxHeight) {
87-
return;
88-
}
89-
90-
this._updateRefresh(newHeight);
91-
92-
newHeight = newHeight < this.pullDown.maxHeight ? newHeight : this.pullDown.maxHeight;
93-
this.height = newHeight;
94-
95-
this.refreshInstance.callMethod(this.pullDown.callPullingDown, {
96-
height: newHeight
97-
});
98-
},
99-
ontouchend(e) {
100-
if (!this.canPullDown) {
101-
return
102-
}
103-
104-
this.refreshInstance.callMethod("onchange", false);
105-
106-
if (this.height > this.pullDown.threshold) {
107-
refreshInstance.callMethod(this.pullDown.callRefresh);
108-
return;
109-
}
110-
111-
this._updateRefresh(0);
112-
},
113-
_updateRefresh(height) {
114-
this.refreshInstance.setStyle({
115-
'height': height
116-
});
11743
}
11844
}
11945
}

components/uni-segmented-control/uni-segmented-control.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@
5454
this.currentIndex = this.current
5555
},
5656
methods: {
57-
_onClick(index) {
57+
_onClick(index) {
5858
if (this.currentIndex !== index) {
59-
this.currentIndex = index
60-
59+
this.currentIndex = index
6160
this.$emit('clickItem', {
6261
currentIndex: index
6362
})
@@ -118,4 +117,4 @@
118117
line-height: 20px;
119118
text-align: center;
120119
}
121-
</style>
120+
</style>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</template>
2222

2323
<script>
24-
import uniSection from '@/components/uni-section/uni-section.vue'
24+
import uniSection from '@/components/uni-section/uni-section'
2525
import uniList from '@/components/uni-list/uni-list.vue'
2626
import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
2727
export default {

pages/extUI/notice-bar/notice-bar.nvue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
<uni-notice-bar :single="true" :show-icon="true" text="uni-app行业峰会频频亮相,开发者反响热烈!" />
1212
<uni-notice-bar :show-icon="true" text="8月12日DCloud受邀参加iWEB峰会后,9月19日DCloud CEO 王安在千人小程序峰会——见实大会,做了主题为《App和小程序,鱼与熊掌如何兼得?》的分享。" />
1313
</view>
14+
<!-- #ifndef MP-BAIDU -->
1415
<uni-section title="文字滚动" type="line"></uni-section>
1516
<view class="example-body">
1617
<uni-notice-bar :scrollable="true" :single="true" text="uni-app行业峰会频频亮相,开发者反响热烈!" />
1718
<uni-notice-bar :show-icon="true" :scrollable="true" :single="true" text="uni-app 1.6版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" />
1819
<uni-notice-bar :scrollable="true" text="8月12日DCloud受邀参加iWEB峰会后,9月19日DCloud CEO 王安在千人小程序峰会——见实大会,做了主题为《App和小程序,鱼与熊掌如何兼得?》的分享。" />
1920
</view>
21+
<!-- #endif -->
2022
<uni-section title="查看更多" type="line"></uni-section>
2123
<view class="example-body">
2224
<uni-notice-bar :show-get-more="true" :single="true" text="年末大礼:uni-app1.4 新增百度、支付宝小程序。插件市场重磅上线!" @getmore="getMore" />

pages/extUI/segmented-control/segmented-control.nvue

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,20 @@
7070
}
7171
},
7272
methods: {
73-
onClickItem(index) {
74-
console.log(index);
75-
if (this.current !== index) {
76-
this.current = index
73+
onClickItem(e) {
74+
if (this.current !== e.currentIndex) {
75+
this.current = e.currentIndex
7776
}
7877
},
79-
styleChange(evt) {
80-
if (this.styleType !== evt.detail.value) {
81-
this.styleType = evt.detail.value
78+
styleChange(e) {
79+
if (this.styleType !== e.detail.value) {
80+
this.styleType = e.detail.value
8281
}
8382
},
84-
colorChange(evt) {
85-
if (this.styleType !== evt.detail.value) {
86-
console.log(evt.detail.value);
87-
this.activeColor = evt.detail.value
83+
colorChange(e) {
84+
if (this.styleType !== e.detail.value) {
85+
console.log(e.detail.value);
86+
this.activeColor = e.detail.value
8887
}
8988
}
9089
}

0 commit comments

Comments
 (0)