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 ### Slots
| 名称 | 说明 | | 名称 | 说明 |
| ------- | -------------------- | | --------- | --------------------------- |
| default | 自定义菜单的展示内容 | | reference | 触发 Popover 显示的元素内容 |

View File

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

View File

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