【发布时间】:2022-10-20 16:09:14
【问题描述】:
我想通过将当前默认背景样式覆盖为红色而不是白色背景来更改我当前的复选框背景颜色。这是我尝试过的当前模板和css。
我试图将primevue按钮默认蓝色按钮覆盖为红色,它工作正常,但primevue复选框并非如此。有人可以帮忙吗?
<template>
<div>
<h2>Test Checbox</h2>
<div class="field-checkbox">
<Checkbox id="test1" name="test" value="test1" v-model="test" />
<label for="test1">Test Checkbox 1</label>
</div>
<div>
<Button label="Select " icon="pi pi-check" iconPos="right" />
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
export default defineComponent({
name: "HelloWorld",
setup() {
const test = ref([]);
return { test }
}
});
</script>
<style scoped>
div {
margin: 1rem 0;
}
.p-checkbox .p-checkbox-box {
background: red !important;
color: red !important;
}
.p-checkbox .p-checkbox-box.p-highlight {
border-color: red !important;
background: red !important;
}
.p-button {
background: red;
}
</style>
【问题讨论】: