File tree Expand file tree Collapse file tree 5 files changed +18
-31
lines changed
Expand file tree Collapse file tree 5 files changed +18
-31
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @xuanmo/dl-common" ,
3- "version" : " 0.0.5-beta.46 " ,
3+ "version" : " 0.0.5-beta.47 " ,
44 "author" : {
55 "name" : " xuanmo" ,
66 "email" : " me@xuanmo.xin"
Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ export default defineComponent({
3131 const style = {
3232 height : props . fullHeight ? '100%' : undefined
3333 }
34-
3534 if ( props . isRoot ) {
3635 const htmlEl = document . querySelector ( 'html' )
36+ const styles : string [ ] = [ ]
3737 if ( htmlEl ) {
3838 for ( const [ key , value ] of Object . entries ( theme . value ) ) {
39- htmlEl . style . setProperty ( key , value )
39+ styles . push ( ` ${ key } : ${ value } ;` )
4040 }
41+ htmlEl . style . cssText += styles . join ( '' )
4142 }
4243 } else {
4344 Object . assign ( style , theme . value )
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export const CONFIG_PROVIDER_PROPS = {
7272 */
7373 isRoot : {
7474 type : Boolean ,
75- default : true
75+ default : false
7676 } ,
7777
7878 /**
Original file line number Diff line number Diff line change @@ -35,24 +35,3 @@ export const useTheme = (props: ConfigProviderProps) => {
3535 return style
3636 } )
3737}
38-
39- export function useStyle ( props : ConfigProviderProps ) {
40- return computed < CSSProperties > ( ( ) => {
41- const style : CSSProperties = {
42- height : props . fullHeight ? '100%' : undefined
43- }
44- if ( props . theme ?. primary ) {
45- Object . assign ( style , generateStyle ( color . generateColors ( props . theme . primary ) , 'primary' ) )
46- }
47- if ( props . theme ?. success ) {
48- Object . assign ( style , generateStyle ( color . generateColors ( props . theme . success ) , 'success' ) )
49- }
50- if ( props . theme ?. warning ) {
51- Object . assign ( style , generateStyle ( color . generateColors ( props . theme . warning ) , 'warning' ) )
52- }
53- if ( props . theme ?. error ) {
54- Object . assign ( style , generateStyle ( color . generateColors ( props . theme . error ) , 'error' ) )
55- }
56- return style
57- } )
58- }
Original file line number Diff line number Diff line change @@ -10,17 +10,24 @@ import './style/index.scss'
1010// 引入图标样式
1111import '../../dl-icons/src/style.scss'
1212
13- const install = function ( app : App ) {
13+ const install = function (
14+ app : App ,
15+ options ?: {
16+ primaryColor ?: string
17+ successColor ?: string
18+ warningColor ?: string
19+ errorColor ?: string
20+ }
21+ ) {
22+ color . generatePrimaryColors ( options ?. primaryColor )
23+ color . generateSuccessColors ( options ?. successColor )
24+ color . generateWarningColors ( options ?. warningColor )
25+ color . generateErrorColors ( options ?. errorColor )
1426 Object . values ( components ) . forEach ( ( component : any ) => {
1527 if ( / ^ d - / . test ( component ?. name ) ) app . use ( component )
1628 } )
1729}
1830
19- color . generatePrimaryColors ( )
20- color . generateSuccessColors ( )
21- color . generateWarningColors ( )
22- color . generateErrorColors ( )
23-
2431export type ComponentNames = keyof typeof components extends infer T
2532 ? T extends `D${infer Name } `
2633 ? `D${Name } `
You can’t perform that action at this time.
0 commit comments