add max height and disabled button
This commit is contained in:
@@ -28,10 +28,14 @@ demo-preview=../demos/bottom-popup/basic.vue
|
|||||||
|
|
||||||
按钮文案传空字符串即可隐藏对应按钮;也可以分别用 `leftButton` / `rightButton` 插槽完全接管,插槽会收到 `onClick`。
|
按钮文案传空字符串即可隐藏对应按钮;也可以分别用 `leftButton` / `rightButton` 插槽完全接管,插槽会收到 `onClick`。
|
||||||
|
|
||||||
|
通过 `left-button-disabled` 和 `right-button-disabled` 分别绑定默认按钮的禁用状态,默认均为 `false`。自定义插槽按钮的禁用状态由插槽自行控制。
|
||||||
|
|
||||||
## 高度
|
## 高度
|
||||||
|
|
||||||
`height` 默认 `"auto"`,按内容撑开;传具体值(如 `"60vh"`)时内容区滚动、标题栏吸顶。
|
`height` 默认 `"auto"`,按内容撑开;传具体值(如 `"60vh"`)时内容区滚动、标题栏吸顶。
|
||||||
|
|
||||||
|
使用 `max-height` 限制弹层最大高度,例如 `max-height="80vh"`;内容超过最大高度时,内容区滚动。数字值以 `px` 为单位。未设置时不限制最大高度。
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
<api-table name="BottomPopup" />
|
<api-table name="BottomPopup" />
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<t-popup v-model="visible" placement="bottom" :z-index="props.zIndex" :overlay-props="props.overlayProps">
|
<t-popup v-model="visible" placement="bottom" :z-index="props.zIndex" :overlay-props="props.overlayProps">
|
||||||
<div class="bottom-popup" :style="{ height: props.height }">
|
<div class="bottom-popup" :style="{ height: props.height, maxHeight: props.maxHeight }">
|
||||||
<div v-if="hasHeader" class="header">
|
<div v-if="hasHeader" class="header">
|
||||||
<div class="button left">
|
<div class="button left">
|
||||||
<slot name="leftButton" :on-click="emitLeftButtonClick">
|
<slot name="leftButton" :on-click="emitLeftButtonClick">
|
||||||
<t-button v-if="leftButtonText" variant="text" size="small" @click="emitLeftButtonClick">
|
<t-button v-if="leftButtonText" variant="text" size="small" :disabled="props.leftButtonDisabled" @click="emitLeftButtonClick">
|
||||||
<span v-text="leftButtonText" />
|
<span v-text="leftButtonText" />
|
||||||
</t-button>
|
</t-button>
|
||||||
</slot>
|
</slot>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="button right">
|
<div class="button right">
|
||||||
<slot name="rightButton" :on-click="emitRightButtonClick">
|
<slot name="rightButton" :on-click="emitRightButtonClick">
|
||||||
<t-button v-if="rightButtonText" theme="primary" variant="text" size="small" @click="emitRightButtonClick">
|
<t-button v-if="rightButtonText" theme="primary" variant="text" size="small" :disabled="props.rightButtonDisabled" @click="emitRightButtonClick">
|
||||||
<span v-text="rightButtonText" />
|
<span v-text="rightButtonText" />
|
||||||
</t-button>
|
</t-button>
|
||||||
</slot>
|
</slot>
|
||||||
@@ -38,7 +38,13 @@ export interface BottomPopupProps {
|
|||||||
modelValue?: boolean;
|
modelValue?: boolean;
|
||||||
leftButtonText?: string;
|
leftButtonText?: string;
|
||||||
rightButtonText?: string;
|
rightButtonText?: string;
|
||||||
|
/** 禁用左侧默认按钮。 */
|
||||||
|
leftButtonDisabled?: boolean;
|
||||||
|
/** 禁用右侧默认按钮。 */
|
||||||
|
rightButtonDisabled?: boolean;
|
||||||
height?: string | number;
|
height?: string | number;
|
||||||
|
/** 弹层最大高度,数字以 px 为单位。 */
|
||||||
|
maxHeight?: string | number;
|
||||||
title?: string;
|
title?: string;
|
||||||
zIndex?: number;
|
zIndex?: number;
|
||||||
overlayProps?: Record<string, unknown>;
|
overlayProps?: Record<string, unknown>;
|
||||||
|
|||||||
Reference in New Issue
Block a user