hybrids components
src/my.counter.ts
:
import { type Component, define, html } from "hybrids";
interface MyCounter {
count: number;
}
function increaseCount(host: MyCounter) {
host.count += 1;
}
const MyCounter: Component<MyCounter> = {
tag: "my-counter",
count: 0,
render: {
shadow: true,
value: ({ count }) => html`
<button onclick="${increaseCount}">
Count: ${count}
</button>
`,
}
}
export default define(MyCounter);
只能用vite编译,bun编译后的代码运行出错,stack超过最大值,parcel不能编译。