@@ -15,22 +15,24 @@ export function Super(component: any) {
1515
1616export function Style ( ) {
1717 return ( target : Vue , key : string , descriptor : PropertyDescriptor ) => {
18- const style = descriptor . value ( ) ;
18+ const style = descriptor . value ( ) ;
19+ createDecorator ( ( options , k ) => {
1920 const newComponent = {
20- // @ts -ignore
21- render ( createElement : any ) {
22- return createElement ( 'style' ,
23- { attrs : { type : 'text/css' , lang : 'css' } } ,
24- // @ts -ignore
25- [ this . $slots . default || style ] ) ;
26- }
21+ // @ts -ignore
22+ render ( createElement : any ) {
23+ // @ts -ignore
24+ const styleScoped = style . replace ( / { ./ gi, '[' + options . _scopeId + '] {' ) ;
25+ return createElement ( 'style' ,
26+ { attrs : { type : 'text/css' , lang : 'css' } } ,
27+ // @ts -ignore
28+ [ this . $slots . default || styleScoped ] ) ;
29+ }
2730 } ;
28- createDecorator ( ( options , k ) => {
29- options . components = options . components || { } ;
30- options . components [ key ] = newComponent ;
31- } ) ( target , key ) ;
32- } ;
33- }
31+ options . components = options . components || { } ;
32+ options . components [ key ] = newComponent ;
33+ } ) ( target , key ) ;
34+ } ;
35+ }
3436
3537export function NextTick ( ) {
3638 return ( target : Vue , key : string , descriptor : any ) => {
0 commit comments