我正在尝试使用模板 js 为 Table Element 创建一个自定义组件。但是当我创建一个组件时,输出不是我所期望的。
import { Component, h, } from "@stencil/core";
@Component({
tag: "table-head",
})
export class table{
render() {
return (
<table class="table">
<thead>
<tr>
<slot/>
</tr>
</thead>
</table>
);
}
}
我在 html 文件中使用上述组件,如下所示。
<table-head>
<th>Frist</th>
<th>second</th>
</table-head>
现在当我检查 html 文件时。<th>
元素没有出现。
当我检查自定义组件时,我看到了类似的东西。<th>
不是包装内容。
<thead>
<tr> Frist
second </tr>
</thead>
我在这里想念什么?