我可以在 Polymer 1.0 模板中使用 <table> 元素吗?
Can I use <table> elements in a Polymer 1.0 template?
我正在尝试在 Polymer 1.0 中创建一个 <custom-table>
元素,它将有 custom-row
个元素作为子元素。但是,custom-row
模板未附加到 custom-table
模板。
自定义-table定义
<dom-module id="custom-table">
<template>
<table>
<tbody>
<content select="custom-row"></content>
</tbody>
</table>
</template>
<script>
Polymer({
is: 'custom-table'
});
</script>
</dom-module>
自定义行定义
<dom-module id="custom-row">
<template>
<tr>
<td>
<content></content>
</td>
</tr>
</template>
<script>
Polymer({
is: 'custom-row'
});
</script>
</dom-module>
而是在 custom-row
元素下方 添加了 custom-table
模板。
jsFiddle: https://jsfiddle.net/gcg8kyb2/
浏览器解析器将尝试通过不呈现或提升无法识别的元素来提供帮助,例如嵌套在 <table>
.
中的 <custom-row>
但是,Polymer 允许您扩展原生元素。请参阅随附的 Polycast 了解操作方法。
我正在尝试在 Polymer 1.0 中创建一个 <custom-table>
元素,它将有 custom-row
个元素作为子元素。但是,custom-row
模板未附加到 custom-table
模板。
自定义-table定义
<dom-module id="custom-table">
<template>
<table>
<tbody>
<content select="custom-row"></content>
</tbody>
</table>
</template>
<script>
Polymer({
is: 'custom-table'
});
</script>
</dom-module>
自定义行定义
<dom-module id="custom-row">
<template>
<tr>
<td>
<content></content>
</td>
</tr>
</template>
<script>
Polymer({
is: 'custom-row'
});
</script>
</dom-module>
而是在 custom-row
元素下方 添加了 custom-table
模板。
jsFiddle: https://jsfiddle.net/gcg8kyb2/
浏览器解析器将尝试通过不呈现或提升无法识别的元素来提供帮助,例如嵌套在 <table>
.
<custom-row>
但是,Polymer 允许您扩展原生元素。请参阅随附的 Polycast 了解操作方法。