feat(Cascader): add close icon

This commit is contained in:
chenjiahan 2020-12-20 13:57:49 +08:00 committed by neverland
parent 347758a935
commit 5d2bd8f6df
3 changed files with 21 additions and 1 deletions

View File

@ -9,7 +9,11 @@
@click="showBase = true"
/>
<van-popup v-model="showBase" round position="bottom">
<van-cascader :title="t('selectArea')" :options="t('options')" />
<van-cascader
:title="t('selectArea')"
:options="t('options')"
@close="showBase = false"
/>
</van-popup>
</demo-block>
</demo-section>

View File

@ -81,10 +81,21 @@ export default createComponent({
}
},
onClose() {
this.$emit('close');
},
renderHeader() {
return (
<div class={bem('header')}>
<h2 class={bem('title')}>{this.slots('title') || this.title}</h2>
{this.closeable ? (
<Icon
name="cross"
class={bem('close-icon')}
onClick={this.onClose}
/>
) : null}
</div>
);
},

View File

@ -15,6 +15,11 @@
line-height: @cascader-title-line-height;
}
&__close-icon {
color: @gray-5;
font-size: 22px;
}
&__tabs {
.van-tab {
flex: none;