我正在使用vuetify扩展面板ui组件(https://vuetifyjs.com/en/components/expansion-panels)。我很确定如何为此添加颜色。如您所见,我一直在尝试将color =“#26c6da”添加到多个组件而没有成功。
<template>
<!-- <v-layout align-start > -->
<!-- <v-layout align-start justify-center row fill-height> -->
<v-container row fill-height justify-center style="max-width: 1200px" class="mx-auto" color="#26c6da">
<!-- <v-layout row fill-height=""> -->
<!-- <v-layout row justify-space-around> -->
<v-flex class="mx-auto" color="#26c6da">
<v-expansion-panel style="max-width: 1200px" class="mx-auto" color="#26c6da" >
<v-expansion-panel-content v-for="(item,i) in items" :key="i">
<div slot="header" class="headline font-weight-bold">{{item.header}}</div>
<v-card >
<v-card-text class="headline font-weight-bold">{{item.text}}</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-flex>
<!-- </v-layout> -->
</v-container>
这是组件Codepen链接:
https://codepen.io/anon/pen/OdJKqm?&editable=true&editors=101
我该如何工作?
答案 0 :(得分:1)
尝试将style="background:#26c6da;color:white"
之类的标准样式添加到所需的任何元素中:
new Vue({
el: '#app',
})
<script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@1.4.0/dist/vuetify.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/vuetify@1.4.0/dist/vuetify.min.css">
<div id="app">
<v-app id="inspire">
<v-expansion-panel>
<v-expansion-panel-content v-for="(item,i) in 5" :key="i" style="background:#26c6da;color:white">
<div slot="header">Item</div>
<v-card>
<v-card-text>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-app>
</div>