且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

定制聚合物元素< x-strong>就像内置的< strong>一样?

更新时间:2023-02-19 17:08:09

要将内容从灯光dom渲染到Polymer元素的阴影中,请使用

To render content from the light dom into your Polymer element's shadow use an insertion point: <content>. Also to style the host element, you can use the :host selector. Both are features of Shadow DOM.

<polymer-element name="x-strong" noscript>
<template>
  <style>
    :host {
      font-weight: bold;
    }
  </style>
  <content></content>
</template>
</polymer-element>

演示: http://jsbin.com/EqaxOTo/1/edit