Skip to content

Commit 0ea8407

Browse files
author
二一
authored
fix(src): 修复segment组件滚动时获取属性报错问题 (#719)
1 parent 0256ca8 commit 0ea8407

File tree

6 files changed

+8
-16
lines changed

6 files changed

+8
-16
lines changed

dist/behaviors/scrollCenter.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sticky-item/index.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
{
2-
"component": true,
3-
"usingComponents": {}
4-
}
1+
{"component":true,"usingComponents":{}}

dist/sticky-item/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<view class="l-sticky-item l-class">
2-
2+
33
<view class="l-sticky-item-header-wrapper l-header-wrapper-class" style="height:{{isFixedTop&&stickyItemWrapperHeight?stickyItemWrapperHeight+'px':'auto'}}"></view>
44
<view style="{{mode==='js'?(isFixedTop?'position:fixed;':''):''}} top:{{top}}rpx" class="l-sticky-item-header l-sticky-item-header{{mode==='js'?(isFixedTop?'-fixed l-header-sticky-class':''):(mode==='css'?'-sticky l-header-sticky-class':'')}} l-header-class">
55
<slot name="header"></slot>

dist/sticky/index.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
{
2-
"component": true,
3-
"usingComponents": {}
4-
}
1+
{"component":true,"usingComponents":{}}

examples/dist/behaviors/scrollCenter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ export default Behavior({
1212
});
1313
},
1414
queryScrollNode(res, currentIndex, type = 'width') {
15+
if(currentIndex<0) return;
1516
const currentRect = res[currentIndex];
16-
1717
this.getRect('.l-tabsscroll').then(_ => {
18+
if(!_) return console.error('找不到元素');
1819
const scrollWidth = _[type];
19-
2020
let transformDistance = res
2121
.slice(0, currentIndex)
2222
.reduce((prev, curr) => prev + curr[type], 0);
23-
2423
transformDistance += (currentRect[type] - scrollWidth) / 2;
2524

2625
if (type === 'width') {

src/behaviors/scrollCenter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ export default Behavior({
1212
});
1313
},
1414
queryScrollNode(res, currentIndex, type = 'width') {
15+
if(currentIndex<0) return;
1516
const currentRect = res[currentIndex];
16-
1717
this.getRect('.l-tabsscroll').then(_ => {
18+
if(!_) return console.error('找不到元素');
1819
const scrollWidth = _[type];
19-
2020
let transformDistance = res
2121
.slice(0, currentIndex)
2222
.reduce((prev, curr) => prev + curr[type], 0);
23-
2423
transformDistance += (currentRect[type] - scrollWidth) / 2;
2524

2625
if (type === 'width') {

0 commit comments

Comments
 (0)