angular/material2 mat-spinner调整大小

Vij*_*y R 34 html css angular-material2

有没有可能改变mat-spinner或大小的方法mat-progress-circle

我读的文档mat-spinnermat-progress-circle,但他们表示,mat-diameter中断和微调将父元素的大小.

如何mat-spinnermat-button不改变按钮高度的情况下放入左角?

<button mat-button>
   <mat-spinner style="float:left;"></mat-spinner> 
   processing....
</button>
Run Code Online (Sandbox Code Playgroud)

我也尝试使用内联css来改变高度

style="float:left;height:10px;width:10px;
Run Code Online (Sandbox Code Playgroud)

但是看起来并不好看.

Phi*_*ief 124

使用最新更新,您应该使用该diameter属性:

<mat-spinner [diameter]="70"></mat-spinner>
Run Code Online (Sandbox Code Playgroud)

直径表示旋转器的宽度和高度的像素量.在这种情况下,它的大小为70x70像素.

请参阅以下stackblitz示例:

https://stackblitz.com/edit/angular-material2-progress-spinner

  • 谢谢你,这应该是答案 (4认同)

And*_*ázi 9

我不确定为什么你的造型没有带来预期的效果.正如你提到的,svg里面的内容md-spinner将扩展到容器的大小,因此应用widthheightmd-spinner应该工作.

CSS

md-spinner {
  float:left; 
  width: 24px; 
  height: 24px; 
  margin: 5px 10px 0px 0px;
}
Run Code Online (Sandbox Code Playgroud)

模板

<button md-raised-button>
  <md-spinner></md-spinner>Raised Button with spinner
</button>
Run Code Online (Sandbox Code Playgroud)

普拉克

http://plnkr.co/edit/RMvCtOCV9f4TxgB4G0Yz?p=preview

这是你想要实现的吗?


Kar*_*hik 9

您可以将其添加到您的 css 文件中:

mat-spinner {
  zoom: 0.2
}
Run Code Online (Sandbox Code Playgroud)

  • [zoom](https://developer.mozilla.org/en-US/docs/Web/CSS/zoom#Specifications) 是非标准的,firefox 不支持它 (5认同)

Tub*_*lçi 5

这是答案:

<mat-spinner mode="indeterminate" style="margin:0 auto;" [diameter]="30"></mat-spinner> 
Run Code Online (Sandbox Code Playgroud)