7
7
<script lang="ts">
8
8
import { computed , defineComponent } from ' vue'
9
9
import { useSizeStyle } from ' ../composable/sizeStyle'
10
+ import { convertToUnit } from ' ../helper'
10
11
11
12
export default defineComponent ({
12
13
name: ' GDialogContent' ,
13
14
props: {
15
+ background: {
16
+ type: [Boolean , String ],
17
+ required: true ,
18
+ },
19
+
20
+ borderRadius: {
21
+ type: [Boolean , Number , String ],
22
+ required: true ,
23
+ },
24
+
14
25
class: {
15
26
type: String ,
16
27
default: ' ' ,
@@ -59,12 +70,37 @@ export default defineComponent({
59
70
' g-dialog-content--scrollable' : props .scrollable ,
60
71
' g-dialog-content--depressed' : props .depressed ,
61
72
' g-dialog-content--fullscreen' : props .fullscreen ,
73
+ ' g-dialog-content--no-bg' : props .background ,
62
74
},
63
75
])
64
76
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
+
65
99
return {
66
100
styles ,
67
101
classes ,
102
+ computedBackground ,
103
+ computedBorderRadius ,
68
104
}
69
105
},
70
106
})
@@ -74,11 +110,16 @@ export default defineComponent({
74
110
.g-dialog-content {
75
111
$dialog : &;
76
112
113
+ --content-bg : var (--g-dialog-content-bg , #fff );
114
+ --content-border-radius : var (--g-dialog-content-border-radius , 4px );
115
+
77
116
pointer-events : auto ;
78
117
overflow-y : auto ;
79
118
transition : 0.3s cubic-bezier (0.25 , 0.8 , 0.25 , 1 );
80
119
width : 100% ;
81
120
z-index : inherit ;
121
+ background : v-bind (' computedBackground' );
122
+ border-radius : v-bind (' computedBorderRadius' );
82
123
83
124
& :not (#{$dialog}--depressed) {
84
125
box-shadow :
@@ -88,7 +129,6 @@ export default defineComponent({
88
129
}
89
130
90
131
& :not (#{$dialog}--fullscreen) {
91
- border-radius : 4px ;
92
132
max-height : 90% ;
93
133
margin : 24px ;
94
134
}
@@ -99,6 +139,7 @@ export default defineComponent({
99
139
100
140
& --fullscreen {
101
141
height : 100% ;
142
+ border-radius : 0 ;
102
143
}
103
144
}
104
145
</style >
0 commit comments