问题描述
我正在学习Polymer.我正在构建用于学习Polymer的应用程序使用 paper-item
元素.我选择paper-item
为它的外观.但是,当我单击纸张项目时,背景变为深灰色.如何删除此行为?我希望paper-item
的背景始终为白色.但是,无法弄清单击或选择paper-item
时如何设置背景色.
I am learning Polymer. The app I'm building to learn Polymer uses the paper-item
element. I've chosen the paper-item
for its look. However, when I click the paper-item, the background changes to a dark gray. How do I remove this behavior? I want the background of the paper-item
to always be white. Yet, cannot figure out how to set the background color when the paper-item
is clicked or selected.
感谢您的帮助,祝您假期愉快!
Thank you for your help and have a great holiday season!
推荐答案
我认为这是需要通过重新定义mixin来更改的重点行为:
I think it's the focused behavior that needs to be changed by redefining the mixin:
<template>
<style>
:root /* or paper-item */ {
--paper-item-focused: {
background-color: white;
}
}
</style>
<paper-item></paper-item>
</template>
如果这不起作用,请尝试使用--paper-item-selected
而不是--paper-item-focused
.
If this doesn't work try --paper-item-selected
instead of --paper-item-focused
.
这篇关于聚合物-单击禁用灰色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!