chore(Popover): change name of default slot to reference

This commit is contained in:
chenjiahan 2020-11-18 15:32:56 +08:00 committed by neverland
parent 699a5ebe51
commit 64e17bcd08
3 changed files with 27 additions and 17 deletions

View File

@ -57,6 +57,6 @@ Vue.use(Popover);
### Slots
| 名称 | 说明 |
| ------- | -------------------- |
| default | 自定义菜单的展示内容 |
| 名称 | 说明 |
| --------- | --------------------------- |
| reference | 触发 Popover 显示的元素内容 |

View File

@ -7,9 +7,11 @@
placement="bottom"
style="margin-left: 16px;"
>
<van-button type="primary" @click="show.lightTheme = true">
{{ t('lightTheme') }}
</van-button>
<template #reference>
<van-button type="primary" @click="show.lightTheme = true">
{{ t('lightTheme') }}
</van-button>
</template>
</van-popover>
<van-popover
v-model="show.darkTheme"
@ -18,9 +20,11 @@
placement="bottom"
style="margin-left: 16px;"
>
<van-button type="primary" @click="show.darkTheme = true">
{{ t('darkTheme') }}
</van-button>
<template #reference>
<van-button type="primary" @click="show.darkTheme = true">
{{ t('darkTheme') }}
</van-button>
</template>
</van-popover>
</demo-block>
@ -55,7 +59,9 @@
:actions="t('shortActions')"
:placement="currentPlacement"
>
<div class="demo-popover-refer" />
<template #reference>
<div class="demo-popover-refer" />
</template>
</van-popover>
</div>
</demo-block>
@ -67,9 +73,11 @@
placement="top"
style="margin-left: 16px;"
>
<van-button type="primary" @click="show.showIcon = true">
{{ t('showIcon') }}
</van-button>
<template #reference>
<van-button type="primary" @click="show.showIcon = true">
{{ t('showIcon') }}
</van-button>
</template>
</van-popover>
<van-popover
@ -78,9 +86,11 @@
placement="top"
style="margin-left: 16px;"
>
<van-button type="primary" @click="show.disabled = true">
{{ t('disabled') }}
</van-button>
<template #reference>
<van-button type="primary" @click="show.disabled = true">
{{ t('disabled') }}
</van-button>
</template>
</van-popover>
</demo-block>
</demo-section>

View File

@ -168,7 +168,7 @@ export default createComponent({
<div class={bem('arrow')} />
{this.actions.map(this.renderAction)}
</Popup>
{this.slots('default')}
{this.slots('reference')}
</span>
);
},