Skip to content

Commit

Permalink
fix(collapse): ensure border property correctly disables bottom border (
Browse files Browse the repository at this point in the history
  • Loading branch information
landluck authored Oct 14, 2024
1 parent 6187937 commit 08796b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/collapse-item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ VantComponent({

data: {
expanded: false,
parentBorder: true,
},

mounted() {
Expand All @@ -41,7 +42,7 @@ VantComponent({
return;
}

const { value, accordion } = this.parent.data;
const { value, accordion, border } = this.parent.data;
const { children = [] } = this.parent;
const { name } = this.data;

Expand All @@ -56,7 +57,7 @@ VantComponent({
setContentAnimate(this, expanded, this.mounted);
}

this.setData({ index, expanded });
this.setData({ index, expanded, parentBorder: border });
},

onClick() {
Expand Down
2 changes: 1 addition & 1 deletion packages/collapse-item/index.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />

<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
<view class="van-collapse-item custom-class {{ index !== 0 && parentBorder ? 'van-hairline--top' : '' }}">
<van-cell
size="{{ size }}"
title="{{ title }}"
Expand Down

0 comments on commit 08796b6

Please sign in to comment.