-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
240 changed files
with
2,720 additions
and
2,595 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<view class="l-badge" bindtap="handleTap"> | ||
<slot/> | ||
<block wx:if="{{show}}"> | ||
<view class="l-badge-content l-class l-class-self" wx:if="{{finalCount}}">{{finalCount}}</view> | ||
<view wx:if="{{content}}" class="l-badge-content l-class l-class-self">{{content}}</view> | ||
<view wx:if="{{dot}}" class="l-badge-dot l-class l-class-self"></view> | ||
<view class="l-badge-content l-class l-class-self l-self-class" wx:if="{{finalCount}}">{{finalCount}}</view> | ||
<view wx:if="{{content}}" class="l-badge-content l-class l-class-self l-self-class">{{content}}</view> | ||
<view wx:if="{{dot}}" class="l-badge-dot l-class l-class-self l-self-class"></view> | ||
</block> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// eslint-disable-next-line no-undef | ||
export default Behavior({ | ||
methods: { | ||
getRect(selector, all = false) { | ||
return new Promise((resolve, reject) => { | ||
const query = wx.createSelectorQuery().in(this); | ||
const type = all ? query.selectAll(selector) : query.select(selector); | ||
type.boundingClientRect((res) => { | ||
if (!res) return reject('找不到元素'); | ||
resolve(res); | ||
}).exec(); | ||
}); | ||
}, | ||
queryScrollNode(res, currentIndex, type = 'width') { | ||
const currentRect = res[currentIndex]; | ||
|
||
this.getRect('.l-tabsscroll').then(_ => { | ||
const scrollWidth = _[type]; | ||
|
||
let transformDistance = res | ||
.slice(0, currentIndex) | ||
.reduce((prev, curr) => prev + curr[type], 0); | ||
|
||
transformDistance += (currentRect[type] - scrollWidth) / 2; | ||
|
||
if (type === 'width') { | ||
this.setData({ | ||
transformX: transformDistance, | ||
transformY: 0 | ||
}); | ||
} else { | ||
this.setData({ | ||
transformX: 0, | ||
transformY: transformDistance | ||
}); | ||
} | ||
}); | ||
}, | ||
queryMultipleNodes() { | ||
const { | ||
placement, | ||
currentIndex | ||
} = this.data; | ||
this.getRect('.l-tabs-item', true) | ||
.then((res) => { | ||
if (['top', 'bottom'].indexOf(placement) !== -1) { | ||
this.queryScrollNode(res, currentIndex); | ||
} else { | ||
this.queryScrollNode(res, currentIndex, 'height'); | ||
} | ||
}); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// eslint-disable-next-line no-undef | ||
export default Behavior({ | ||
observers: { | ||
'show': function (show) { | ||
show && this.changeStatus(); | ||
if (!show) this.setData({ | ||
status: show | ||
}); | ||
} | ||
}, | ||
methods: { | ||
changeStatus() { | ||
this.setData({ | ||
status: true | ||
}); | ||
if (this.data.timer) clearTimeout(this.data.timer); | ||
this.data.timer = setTimeout(() => { | ||
this.setData({ | ||
status: false | ||
}); | ||
if (this.data.success) this.data.success(); | ||
this.data.timer = null; | ||
}, this.properties.duration); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.