我在Angular 2中查看md-grid-list的基本示例.
<md-grid-list cols="4" rowHeight="100px"> <md-grid-tile *ngFor="let tile of tiles" [colspan]="tile.cols" [rowspan]="tile.rows" [style.background]="tile.color"> {{tile.text}} </md-grid-tile> </md-grid-list>
TS代码:
export class GridListDynamicExample { tiles = [ {text: 'One',cols: 3,rows: 1,color: 'lightblue'},{text: 'Two',cols: 1,rows: 2,color: 'lightgreen'},{text: 'Three',color: 'lightpink'},{text: 'Four',cols: 2,color: '#DDBDF1'},]; }
上面的代码导致了这个:
如何使用某些HTML指令或CSS将布局设置为“列”“列”,以便在较小屏幕尺寸的行(One和Four)下方?
Angular 1中的Angular Material可以选择通过指定“md-cols-xs =”1“md-cols-sm =”2“md-cols-md =”4“md-cols-gt-md =”6“ ”.
解决方法
This is the simplest Way you can achive that