简体   繁体   English

角度材料网格xs不工作

[英]angular material grid xs not working

<md-grid-list md-cols-lg="4" md-cols-sm="2" md-cols-xs="1" md-cols-md="2" md-gutter="3em" md-row-height='250px'>
       <md-grid-tile><div>one</div></md-grid-tile>
       <md-grid-tile><div>two</div></md-grid-tile>
       <md-grid-tile> <div>three</div> </md-grid-tile>
       <md-grid-tile>  <div>four</div></md-grid-tile>
 </md-grid-list>

This is working fine in sm , md and lg but not working in xs (extra small devices) 这在sm,md和lg中运行正常,但在xs(超小设备)中不起作用

Well I've pasted your html and it's working on this codepen 好吧,我已经粘贴了你的HTML,它正在使用这个代码

<div ng-controller="AppCtrl" ng-app="MyApp">
   <md-grid-list md-cols-lg="4" md-cols-sm="2" md-cols-xs="1" md-cols-md="2" md-gutter="3em" md-row-height='250px'>
      <md-grid-tile><div>one</div></md-grid-tile>
      <md-grid-tile><div>two</div></md-grid-tile>
      <md-grid-tile> <div>three</div> </md-grid-tile>
      <md-grid-tile>  <div>four</div></md-grid-tile>
   </md-grid-list>
</div>

What's the error you are getting? 你得到的错误是什么?

Update 更新

Since Material is strictly looking for md-cols attribute you need to define a md-cols="[col number you want]" as default and then use query definitons to change the value. 由于Material严格查找md-cols属性,因此您需要将md-cols="[col number you want]"为默认值,然后使用查询定义来更改值。 Such as: 如:

   <md-grid-list md-cols="4" md-cols-sm="2" md-cols-xs="1" md-cols-md="2">
   </md-grid-list> 

please note that this default value will be affecting all the screen sizes you don't cover with queries. 请注意,此默认值将影响您未查询的所有屏幕尺寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM