File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1414>
1515 <block wx:if="{{active}}">
1616 <view class="{{classPrefix}}__line"></view>
17- <view class="{{classPrefix}}__prefix"></view>
18- <view class="{{classPrefix}}__suffix"></view>
17+ <view wx:if="{{!isFirstChild}}" class="{{classPrefix}}__prefix"></view>
18+ <view wx:if="{{!isLastChild}}" class="{{classPrefix}}__suffix"></view>
1919 </block>
2020 <template wx:if="{{_icon}}" is="icon" data="{{ tClass: classPrefix + '__icon', ..._icon }}" />
2121 <block wx:if="{{badgeProps}}">
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import props from './props';
44
55const { prefix } = config ;
66const name = `${ prefix } -side-bar` ;
7- const relationsPath = '../side-bar-item/side-bar-item' ;
87
98@wxComponent ( )
109export default class SideBar extends SuperComponent {
@@ -13,7 +12,7 @@ export default class SideBar extends SuperComponent {
1312 children = [ ] ;
1413
1514 relations : RelationsOptions = {
16- [ relationsPath ] : {
15+ '../side-bar-item/side-bar-item' : {
1716 type : 'child' ,
1817 linked ( child ) {
1918 this . children . push ( child ) ;
@@ -36,8 +35,13 @@ export default class SideBar extends SuperComponent {
3635
3736 observers = {
3837 value ( v ) {
39- this . $children . forEach ( ( item ) => {
38+ const sideBarItems = this . $children ;
39+ sideBarItems . forEach ( ( item , index ) => {
4040 item . updateActive ( v ) ;
41+ item . setData ( {
42+ isFirstChild : index === 0 ,
43+ isLastChild : index === sideBarItems . length - 1 ,
44+ } ) ;
4145 } ) ;
4246 } ,
4347 } ;
You can’t perform that action at this time.
0 commit comments