Skip to content
This repository was archived by the owner on Jan 9, 2022. It is now read-only.

Commit 0098dac

Browse files
committed
feat(main): add height prop for GDialog
1 parent ee7b712 commit 0098dac

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

src/components/GDialog.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
:style="styles"
1717
>
1818
<GDialogContent
19-
:width="width"
2019
:max-width="maxWidth"
20+
:width="width"
21+
:height="height"
2122
:scrollable="scrollable"
2223
:depressed="depressed"
2324
>
@@ -89,6 +90,11 @@ export default defineComponent({
8990
default: 'auto',
9091
},
9192
93+
height: {
94+
type: [String, Number],
95+
default: 'auto',
96+
},
97+
9298
scrollable: {
9399
type: Boolean,
94100
default: false,

src/components/GDialogContent.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script lang="ts">
88
import { computed, defineComponent } from 'vue'
9-
import { useWidthStyle } from '../composable/widthStyle'
9+
import { useSizeStyle } from '../composable/sizeStyle'
1010
1111
export default defineComponent({
1212
name: 'GDialogContent',
@@ -21,6 +21,11 @@ export default defineComponent({
2121
default: 'auto',
2222
},
2323
24+
height: {
25+
type: [String, Number],
26+
default: 'auto',
27+
},
28+
2429
scrollable: {
2530
type: Boolean,
2631
default: false,
@@ -36,7 +41,7 @@ export default defineComponent({
3641
},
3742
3843
setup(props) {
39-
const { widthStyles: styles } = useWidthStyle(props)
44+
const { sizeStyles: styles } = useSizeStyle(props)
4045
const classes = computed(() => [
4146
'q-dialog-content',
4247
{

src/composable/widthStyle.ts renamed to src/composable/sizeStyle.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { computed } from 'vue'
33
// helpers
44
import { convertToUnit } from '../helper'
55

6-
export interface WidthProps {
6+
export interface SizeProps {
77
maxWidth?: number | string
88
width?: number | string
9+
height?: number | string
910
}
1011

11-
export const useWidthStyle = (props: WidthProps) => {
12-
const widthStyles = computed(() => ({
12+
export const useSizeStyle = (props: SizeProps) => {
13+
const sizeStyles = computed(() => ({
1314
maxWidth:
1415
props.maxWidth === 'none'
1516
? undefined
@@ -19,9 +20,14 @@ export const useWidthStyle = (props: WidthProps) => {
1920
props.width === 'auto'
2021
? undefined
2122
: convertToUnit(props.width),
23+
24+
height:
25+
props.height === 'auto'
26+
? undefined
27+
: convertToUnit(props.height),
2228
}))
2329

2430
return {
25-
widthStyles,
31+
sizeStyles,
2632
}
2733
}

0 commit comments

Comments
 (0)