Skip to content

Commit

Permalink
feat(cascader): 新增title插槽
Browse files Browse the repository at this point in the history
link #119
  • Loading branch information
yang1206 committed Nov 23, 2023
1 parent 04d9262 commit 80b2f29
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/components/dentry/cascader.md
Expand Up @@ -368,6 +368,12 @@ export default {
| change | 选中值改变时触发 | `(value, pathNodes)` |
| path-change | 选中项改变时触发 | `(pathNodes)` |

### Slots

| 名称 | 说明 |
|-------|----------|
| title `v1.5.4` | 自定义顶部标题部分 |

## 主题定制

### 样式变量
Expand Down
8 changes: 7 additions & 1 deletion example/src/pages/demo/dentry/cascader/index.vue
Expand Up @@ -207,7 +207,13 @@ export default {
:options="demo1.options"
@change="events.change"
@pathChange="events.pathChange"
/>
>
<template #title>
<view class="p-20px text-center fw-700">
地址选择
</view>
</template>
</nut-cascader>

<h2 class="title">
自定义属性名称
Expand Down
8 changes: 5 additions & 3 deletions packages/nutui/components/cascader/cascader.vue
Expand Up @@ -67,9 +67,11 @@ export default defineComponent({
:close-icon-position="closeIconPosition"
:lock-scroll="lockScroll"
>
<template v-if="title">
<rich-text class="nut-cascader__bar" :nodes="title" />
</template>
<slot name="title">
<template v-if="title">
<rich-text class="nut-cascader__bar" :nodes="title" />
</template>
</slot>

<NutCascaderItem
:model-value="innerValue"
Expand Down

0 comments on commit 80b2f29

Please sign in to comment.