mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Cascader): add close icon
This commit is contained in:
parent
347758a935
commit
5d2bd8f6df
@ -9,7 +9,11 @@
|
|||||||
@click="showBase = true"
|
@click="showBase = true"
|
||||||
/>
|
/>
|
||||||
<van-popup v-model="showBase" round position="bottom">
|
<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>
|
</van-popup>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
</demo-section>
|
</demo-section>
|
||||||
|
@ -81,10 +81,21 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
this.$emit('close');
|
||||||
|
},
|
||||||
|
|
||||||
renderHeader() {
|
renderHeader() {
|
||||||
return (
|
return (
|
||||||
<div class={bem('header')}>
|
<div class={bem('header')}>
|
||||||
<h2 class={bem('title')}>{this.slots('title') || this.title}</h2>
|
<h2 class={bem('title')}>{this.slots('title') || this.title}</h2>
|
||||||
|
{this.closeable ? (
|
||||||
|
<Icon
|
||||||
|
name="cross"
|
||||||
|
class={bem('close-icon')}
|
||||||
|
onClick={this.onClose}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
line-height: @cascader-title-line-height;
|
line-height: @cascader-title-line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__close-icon {
|
||||||
|
color: @gray-5;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
&__tabs {
|
&__tabs {
|
||||||
.van-tab {
|
.van-tab {
|
||||||
flex: none;
|
flex: none;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user