2017-08-15 107 views

回答

0

您可以手动设置为跟随,

比方说,你有一个在home.component.css称为home.component.ts

@Component({ 
    moduleId: module.id, 
    selector: 'home', 
    styleUrls: ['home.component.css'], 
    templateUrl: 'home.component.html', 
)} 

所以组件,您可以设置它的高度和下面的宽度,

:host {    // host targets selector: 'home' 

    display: block; 
    left: 0; 

    width: 100%; // takes parent width   
    OR  
    widht: 1000px // screen of having 1000px of width 


    height: 100%; // takes parent height  
    OR   
    height: 1000px // screen of having 1000px of height 
} 
+0

对不起,先生,请再帮我一个忙。如果我通过ngFor呈现组件。我的旧组件仍然有旧尺寸,我的新组件也有这个尺寸。因为我的新组件无法在html中显示。请帮我做元件没有尺寸,只有元件里面有。非常感谢 – BaoBao

+0

@宝宝。发生了什么? – micronyks

+0

我完全无法理解您的问题。 – micronyks

相关问题