如何定制特定离子组件
我是离子的新手 我
have this lines of code :
<ion-buttons slot="start">
<ion-back-button :default-href="pageDefaultBackLink"></ion-back-button>
<ion-button router-link="/memories/add" color="light">---1---</ion-button>
<ion-button router-link="/memories/add" color="light">---2---</ion-button>
<ion-button router-link="/memories/add" color="light">---3---</ion-button>
<ion-button router-link="/memories/add" color="light">---4---</ion-button>
</ion-buttons>
正在尝试做的是在最后一个Ion-button组件中添加一些自定义样式,但我不知道该怎么做, NB:我正在将VUE 3与离子6一起使用
i new to ionic ,
i
have this lines of code :
<ion-buttons slot="start">
<ion-back-button :default-href="pageDefaultBackLink"></ion-back-button>
<ion-button router-link="/memories/add" color="light">---1---</ion-button>
<ion-button router-link="/memories/add" color="light">---2---</ion-button>
<ion-button router-link="/memories/add" color="light">---3---</ion-button>
<ion-button router-link="/memories/add" color="light">---4---</ion-button>
</ion-buttons>
what i'm trying to do is add some custom style to the last ion-button component , but i have no idea how i can do that ,
Nb: i'm using vue 3 with ionic 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在全球或相应的SASS文件(.scss)上使用CSS,然后将其添加到CSS文件中的类或ID中。
您可以使用RAW CSS直接更改某些样式,有些则必须访问Shadow dom。
例如,您的
ion-button
和CSS可能看起来像:CSS:
将为使用
mybutton
类的任何地方分配30px的字体大小。看看 ion-button css自定义属性正确的方向。
您还将从CSS上阅读和 w3schools 是一个很好的起点。
You need to use CSS, either globally or on the corresponding Sass file (.scss) and add that to a class or ID which you then target in the CSS file.
Some styles you can change directly using raw CSS, some you have to access the Shadow DOM.
For example, your
ion-button
and CSS could look like this:CSS:
That will assign a font size of 30px to everywhere you use the
myButton
class.Take a look at ion-button CSS custom properties for a push in the right direction.
You would also benefit from reading up on CSS and w3schools is a great starting point.