英文:
Change icon color for v-select component
问题
I set an icon to v-select
component but I want to change its color to red.
<v-select
:items="items"
label="Standard"
prepend-icon="edit"
></v-select>
How to colorize the icon ?
英文:
I set an icon to v-select
component but I want to change its color to red.
<div id="app">
<v-app id="inspire">
<v-container fluid>
<v-row align="center">
<v-col class="d-flex" cols="12" sm="6">
<v-select
:items="items"
label="Standard"
prepend-icon="edit"
></v-select>
</v-col>
</v-row>
</v-container>
</v-app>
</div>
How to colorize the icon ?
答案1
得分: 6
只需使用插槽 prepend
<v-select
:items="items"
label="Standard">
<template v-slot:prepend>
<v-icon color="red">edit</v-icon>
</template>
</v-select>
英文:
Just use the slot prepend
<v-select
:items="items"
label="Standard">
<template v-slot:prepend>
<v-icon color="red">edit</v-icon>
</template>
</v-select>
答案2
得分: 2
请查看Vuetify文档。
https://vuetifyjs.com/en/components/selects#selects
如果您检查示例,HTML部分是:
<i aria-hidden="true" class="v-icon notranslate material-icons theme--light">map</i>
Vuetify有用于颜色的抽象类。在这种情况下是:.theme--light.v-icon
颜色的文档在这里:
https://vuetifyjs.com/en/styles/colors#
在那里,您可以选择所需的颜色,并通过Sass进行更改。
此外,您可以这样设置它:
.v-icon {
color: ##0F0F0F;
}
英文:
Check Vuetify documentation.
https://vuetifyjs.com/en/components/selects#selects
If you inspect the example, the html is:
<i aria-hidden="true" class="v-icon notranslate material-icons theme--light">map</i>
Vuetify has abstract classes for colors. In this case: .theme--light.v-icon
The documentation of colors is:
https://vuetifyjs.com/en/styles/colors#
There you could select the color you want and via sass change it.
Furthermore, you could set it like:
.v-icon {
color: ##0F0F0F;
}
答案3
得分: 0
你可以使用Markup简单地改变颜色
<div id="app">
<v-app id="inspire">
<v-container fluid>
<v-row align="center">
<v-col class="d-flex" cols="12" sm="6">
<v-select
:items="items"
label="标准"
prepend-icon="edit"
>
<template v-slot:prepend>
<v-icon color="绿色">edit</v-icon>
</template>
</v-select>
</v-col>
</v-row>
</v-container>
</v-app>
</div>
查看链接: https://codepen.io/pen/BaymmWQ
英文:
You can change color simply using Markup
<div id="app">
<v-app id="inspire">
<v-container fluid>
<v-row align="center">
<v-col class="d-flex" cols="12" sm="6">
<v-select
:items="items"
label="Standard"
prepend-icon="edit"
>
<template v-slot:prepend>
<v-icon color="green">edit</v-icon>
</template>
</v-select>
</v-col>
</v-row>
</v-container>
</v-app>
</div>
See link: https://codepen.io/pen/BaymmWQ
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论