如何访问孙元素';css在聚合物中的混合?

如何访问孙元素';css在聚合物中的混合?,css,polymer,polymer-2.x,Css,Polymer,Polymer 2.x,我有一个聚合物组件,它在模板中使用了另一个组件(按钮容器)。所说的子组件还使用另一个组件(按钮本身),当它被禁用时,我需要为该按钮添加一些样式。大概是这样的: <dom-module id="parent-component"> <template> ... template elements <confirm-buttons-container id="child-component" config$="[[someConfigVari

我有一个聚合物组件,它在模板中使用了另一个组件(按钮容器)。所说的子组件还使用另一个组件(按钮本身),当它被禁用时,我需要为该按钮添加一些样式。大概是这样的:

<dom-module id="parent-component">
  <template>
    ... template elements
        <confirm-buttons-container id="child-component" config$="[[someConfigVariable]]" ></confirm-buttons-container>

  </template>
</dom-module>

<dom-module id="confirm-buttons-container">
  <template>
      <dom-if if="[[config.buttons.primary]]">
        <template>
          <grandchild-component-button class$="[[config.buttons.primary.class]]">
            <button
              id="primaryBtn"
              name="primary"
              inner-h-t-m-l="[[t(config.buttons.primary.text)]]"
              disabled$="[[config.buttons.primary.disabled]]">
            </button>
          </grandchild-component-button>
        </template>
      </dom-if>
  </template>
</dom-module>

... 模板元素
子组件是这样的:

<dom-module id="parent-component">
  <template>
    ... template elements
        <confirm-buttons-container id="child-component" config$="[[someConfigVariable]]" ></confirm-buttons-container>

  </template>
</dom-module>

<dom-module id="confirm-buttons-container">
  <template>
      <dom-if if="[[config.buttons.primary]]">
        <template>
          <grandchild-component-button class$="[[config.buttons.primary.class]]">
            <button
              id="primaryBtn"
              name="primary"
              inner-h-t-m-l="[[t(config.buttons.primary.text)]]"
              disabled$="[[config.buttons.primary.disabled]]">
            </button>
          </grandchild-component-button>
        </template>
      </dom-if>
  </template>
</dom-module>

子组件有一个mixin,用于设置孙子组件的样式,还有一个mixin,用于设置我要更改的属性的样式。当config.buttons.primary.disabled为true时,如何从父组件访问所述mixin


提前感谢您的帮助。

将此css添加到您的样式中:


#父组件#确认按钮容器[disabled=“true”]{color:red;}
将此css添加到样式中:


#父组件#确认按钮容器[disabled=“true”]{color:red;}
首先,孙子必须在其类/样式中有一个mixin。否则,将无法访问。

首先,孙辈必须在他们的课程/风格中融入。否则,将无法访问。