[new feature] Collapse: add border prop (#1408)

This commit is contained in:
neverland 2019-03-13 17:47:21 +08:00 committed by GitHub
parent 89a64a52c8
commit cb925a2ba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 4 deletions

View File

@ -60,7 +60,7 @@ VantComponent({
this.updateStyle(expanded);
}
this.set({ expanded });
this.set({ index, expanded });
},
updateStyle(expanded: boolean) {

View File

@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-collapse-item van-hairline--top custom-class">
<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
<van-cell
title="{{ title }}"
title-class="title-class"

View File

@ -12,6 +12,7 @@
### 代码演示
#### 基础用法
通过`value`控制展开的面板列表,`activeNames`为数组格式
```html
@ -42,6 +43,7 @@ Page({
```
#### 手风琴
通过`accordion`可以设置为手风琴模式,最多展开一个面板,此时`activeName`为字符串格式
```html
@ -104,6 +106,7 @@ Page({
|------|------|------|------|------|
| value | 当前展开面板的 name | `Array | String | Number` | - |
| accordion | 是否开启手风琴模式 | `Boolean` | `false` |
| border | 是否显示外边框 | `Boolean` | `true` |
### Collapse Event

View File

@ -0,0 +1 @@
@import '../common/style/var.less';

View File

@ -14,8 +14,12 @@ VantComponent({
},
props: {
value: null,
accordion: Boolean,
value: null
border: {
type: Boolean,
value: true
}
},
data: {

View File

@ -1,3 +1,3 @@
<view class="van-collapse van-hairline--top-bottom custom-class">
<view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }}">
<slot />
</view>