Ionic2 圆段按钮
Ionic2 round segment-button
有谁知道如何将分段按钮的 css 从方形更改为圆形?
我尝试使用普通 css but it gets wierd when ionic2 tries to transform the button on segment-activated
Here is a Plunker 示例
<ion-segment [(ngModel)]="date" danger>
<ion-segment-button value="1">
1
</ion-segment-button>
<ion-segment-button value="2">
2
</ion-segment-button>
<ion-segment-button value="3">
3
</ion-segment-button>
</ion-segment>
正常css我失败了。当你 select 另一个按钮时它会变得很奇怪
找到了一个黑客来做到这一点。 注意这是一个 hack,风格不适合这个。
Css 解决方案:将其放入您的 .scss
文件
ion-segment-button{
//max-width: 25px;
border-style: solid;
}
.segment-button {
border-style: none;
border-color: #e62100;
color: #e62100;
border-width: thin;
}
.segment-button:first-of-type {
border-radius: 90px 90px 90px 90px;
// margin-right: 0px;
margin-left: 0px;
line-height: 3.4rem;
height: 100%;
width: 100%}
.segment-button:not(:first-of-type) {
border-radius: 90px 90px 90px 90px;
// margin-right: 0px;
margin-left: 20px;
line-height: 3.4rem;
height: 100%;
width: 100%;}
.segment-button:last-of-type {
border-radius: 90px 90px 90px 90px;
margin-right: 0px;
margin-left: 20px;
line-height: 3.4rem;
height: 100%;
width: 100%;}
.segment-activated{
background-color: #e62100;
color: #ffffff;
}
有谁知道如何将分段按钮的 css 从方形更改为圆形?
我尝试使用普通 css but it gets wierd when ionic2 tries to transform the button on segment-activated
Here is a Plunker 示例
<ion-segment [(ngModel)]="date" danger>
<ion-segment-button value="1">
1
</ion-segment-button>
<ion-segment-button value="2">
2
</ion-segment-button>
<ion-segment-button value="3">
3
</ion-segment-button>
</ion-segment>
正常css我失败了。当你 select 另一个按钮时它会变得很奇怪
找到了一个黑客来做到这一点。 注意这是一个 hack,风格不适合这个。
Css 解决方案:将其放入您的 .scss
文件
ion-segment-button{
//max-width: 25px;
border-style: solid;
}
.segment-button {
border-style: none;
border-color: #e62100;
color: #e62100;
border-width: thin;
}
.segment-button:first-of-type {
border-radius: 90px 90px 90px 90px;
// margin-right: 0px;
margin-left: 0px;
line-height: 3.4rem;
height: 100%;
width: 100%}
.segment-button:not(:first-of-type) {
border-radius: 90px 90px 90px 90px;
// margin-right: 0px;
margin-left: 20px;
line-height: 3.4rem;
height: 100%;
width: 100%;}
.segment-button:last-of-type {
border-radius: 90px 90px 90px 90px;
margin-right: 0px;
margin-left: 20px;
line-height: 3.4rem;
height: 100%;
width: 100%;}
.segment-activated{
background-color: #e62100;
color: #ffffff;
}