File tree Expand file tree Collapse file tree 6 files changed +12
-9
lines changed Expand file tree Collapse file tree 6 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ Component({
38
38
console . error ( '[data]参数类型错误,渲染失败' ) ;
39
39
return false ;
40
40
}
41
+ // 绑定data,判断data是否为[]
42
+ this . setData ( { data } ) ;
41
43
if ( refresh ) {
42
44
this . data . leftData = [ ] ;
43
45
this . data . rightData = [ ] ;
@@ -50,15 +52,14 @@ Component({
50
52
_select ( data , refresh ) {
51
53
const query = wx . createSelectorQuery ( ) . in ( this ) ;
52
54
this . columnNodes = query . selectAll ( '#left, #right' ) ;
53
-
54
55
return new Promise ( ( resolve ) => {
55
56
this . _render ( data , 0 , refresh , ( ) => {
56
57
resolve ( ) ;
57
58
} ) ;
58
59
} ) ;
59
60
} ,
60
61
_render ( data , i , refresh , success ) {
61
- if ( data . length > i ) {
62
+ if ( ( data . length > i || refresh ) && this . data . data . length !== 0 ) {
62
63
this . columnNodes . boundingClientRect ( ) . exec ( res => {
63
64
const rects = res [ 0 ] ;
64
65
this . data . leftHeight = rects [ 0 ] . height ;
Original file line number Diff line number Diff line change 1
- <view class="l-class water-flow-container">
1
+ <view class="l-class water-flow-container" wx:if="{{data.length!==0}}" >
2
2
<view class="water-column" style="margin-right:{{columnGap}}">
3
3
<view id="left">
4
4
<block wx:for="{{leftData}}" wx:key="{{index}}">
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ Component({
38
38
console . error ( '[data]参数类型错误,渲染失败' ) ;
39
39
return false ;
40
40
}
41
+ // 绑定data,判断data是否为[]
42
+ this . setData ( { data } ) ;
41
43
if ( refresh ) {
42
44
this . data . leftData = [ ] ;
43
45
this . data . rightData = [ ] ;
@@ -50,15 +52,14 @@ Component({
50
52
_select ( data , refresh ) {
51
53
const query = wx . createSelectorQuery ( ) . in ( this ) ;
52
54
this . columnNodes = query . selectAll ( '#left, #right' ) ;
53
-
54
55
return new Promise ( ( resolve ) => {
55
56
this . _render ( data , 0 , refresh , ( ) => {
56
57
resolve ( ) ;
57
58
} ) ;
58
59
} ) ;
59
60
} ,
60
61
_render ( data , i , refresh , success ) {
61
- if ( data . length > i ) {
62
+ if ( ( data . length > i || refresh ) && this . data . data . length !== 0 ) {
62
63
this . columnNodes . boundingClientRect ( ) . exec ( res => {
63
64
const rects = res [ 0 ] ;
64
65
this . data . leftHeight = rects [ 0 ] . height ;
Original file line number Diff line number Diff line change 1
- <view class="l-class water-flow-container">
1
+ <view class="l-class water-flow-container" wx:if="{{data.length!==0}}" >
2
2
<view class="water-column" style="margin-right:{{columnGap}}">
3
3
<view id="left">
4
4
<block wx:for="{{leftData}}" wx:key="{{index}}">
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ Component({
38
38
console . error ( '[data]参数类型错误,渲染失败' ) ;
39
39
return false ;
40
40
}
41
+ // 绑定data,判断data是否为[]
42
+ this . setData ( { data } ) ;
41
43
if ( refresh ) {
42
44
this . data . leftData = [ ] ;
43
45
this . data . rightData = [ ] ;
@@ -50,15 +52,14 @@ Component({
50
52
_select ( data , refresh ) {
51
53
const query = wx . createSelectorQuery ( ) . in ( this ) ;
52
54
this . columnNodes = query . selectAll ( '#left, #right' ) ;
53
-
54
55
return new Promise ( ( resolve ) => {
55
56
this . _render ( data , 0 , refresh , ( ) => {
56
57
resolve ( ) ;
57
58
} ) ;
58
59
} ) ;
59
60
} ,
60
61
_render ( data , i , refresh , success ) {
61
- if ( data . length > i ) {
62
+ if ( ( data . length > i || refresh ) && this . data . data . length !== 0 ) {
62
63
this . columnNodes . boundingClientRect ( ) . exec ( res => {
63
64
const rects = res [ 0 ] ;
64
65
this . data . leftHeight = rects [ 0 ] . height ;
Original file line number Diff line number Diff line change 1
- <view class="l-class water-flow-container">
1
+ <view class="l-class water-flow-container" wx:if="{{data.length!==0}}" >
2
2
<view class="water-column" style="margin-right:{{columnGap}}">
3
3
<view id="left">
4
4
<block wx:for="{{leftData}}" wx:key="{{index}}">
You can’t perform that action at this time.
0 commit comments