77<script lang="ts">
88import { computed , defineComponent } from ' vue'
99import { useSizeStyle } from ' ../composable/sizeStyle'
10+ import { convertToUnit } from ' ../helper'
1011
1112export default defineComponent ({
1213 name: ' GDialogContent' ,
1314 props: {
15+ background: {
16+ type: [Boolean , String ],
17+ required: true ,
18+ },
19+
20+ borderRadius: {
21+ type: [Boolean , Number , String ],
22+ required: true ,
23+ },
24+
1425 class: {
1526 type: String ,
1627 default: ' ' ,
@@ -59,12 +70,37 @@ export default defineComponent({
5970 ' g-dialog-content--scrollable' : props .scrollable ,
6071 ' g-dialog-content--depressed' : props .depressed ,
6172 ' g-dialog-content--fullscreen' : props .fullscreen ,
73+ ' g-dialog-content--no-bg' : props .background ,
6274 },
6375 ])
6476
77+ const computedBackground = computed (() => {
78+ if (typeof props .background === ' string' ) {
79+ return props .background
80+ } else if (props .background ) {
81+ return ' var(--content-bg)'
82+ }
83+
84+ return ' transparent'
85+ })
86+
87+ const computedBorderRadius = computed (() => {
88+ if (typeof props .borderRadius === ' string' ) {
89+ return convertToUnit (props .borderRadius )
90+ } else if (props .borderRadius ) {
91+ return ' var(--content-border-radius)'
92+ }
93+
94+ return ' 0'
95+ })
96+
97+ // const computedBorderRadius = computed(() => convertToUnit(props.borderRadius))
98+
6599 return {
66100 styles ,
67101 classes ,
102+ computedBackground ,
103+ computedBorderRadius ,
68104 }
69105 },
70106})
@@ -74,11 +110,16 @@ export default defineComponent({
74110.g-dialog-content {
75111 $dialog : &;
76112
113+ --content-bg : var (--g-dialog-content-bg , #fff );
114+ --content-border-radius : var (--g-dialog-content-border-radius , 4px );
115+
77116 pointer-events : auto ;
78117 overflow-y : auto ;
79118 transition : 0.3s cubic-bezier (0.25 , 0.8 , 0.25 , 1 );
80119 width : 100% ;
81120 z-index : inherit ;
121+ background : v-bind (' computedBackground' );
122+ border-radius : v-bind (' computedBorderRadius' );
82123
83124 & :not (#{$dialog}--depressed) {
84125 box-shadow :
@@ -88,7 +129,6 @@ export default defineComponent({
88129 }
89130
90131 & :not (#{$dialog}--fullscreen) {
91- border-radius : 4px ;
92132 max-height : 90% ;
93133 margin : 24px ;
94134 }
@@ -99,6 +139,7 @@ export default defineComponent({
99139
100140 & --fullscreen {
101141 height : 100% ;
142+ border-radius : 0 ;
102143 }
103144}
104145 </style >
0 commit comments