mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
feat(SideBar): title slot (#2873)
This commit is contained in:
parent
9a3b5df803
commit
3beb578d6b
@ -13,3 +13,16 @@
|
||||
<van-sidebar-item title="标签名称" info="99+" />
|
||||
</van-sidebar>
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="自定义标题" class="custom-sidebar-slot">
|
||||
<van-sidebar custom-class="custom-sidebar" bind:change="onChange">
|
||||
<van-sidebar-item info="5">
|
||||
<view slot="title">
|
||||
<van-icon name="wap-home-o" />
|
||||
标签名称
|
||||
</view>
|
||||
</van-sidebar-item>
|
||||
<van-sidebar-item title="标签名称" info="5" />
|
||||
<van-sidebar-item title="标签名称" info="99+" />
|
||||
</van-sidebar>
|
||||
</demo-block>
|
||||
|
@ -5,3 +5,7 @@ page {
|
||||
.custom-sidebar {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.custom-sidebar-slot {
|
||||
--sidebar-width: 100px;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
info="{{ info }}"
|
||||
custom-style="right: 4px"
|
||||
/>
|
||||
{{ title }}
|
||||
<view wx:if="{{ title }}">{{ title }}</view>
|
||||
<slot wx:else name="title" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -82,6 +82,12 @@ Page({
|
||||
| dot | 是否显示右上角小红点 | *boolean* | `false` | - |
|
||||
| info | 提示消息 | *string \| number* | `''` | - |
|
||||
|
||||
### SidebarItem Slot
|
||||
|
||||
| 名称 | 说明 |
|
||||
|-----------|-----------|
|
||||
| title | 自定义标题栏,如果设置了`title`属性则不生效 |
|
||||
|
||||
### SidebarItem Event
|
||||
|
||||
| 事件名 | 说明 | 参数 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user