尝试stenciljs
文档-https://stenciljs.com/docs/templating-jsx中的示例代码时,我遇到了一个问题。 click事件处理程序根本不会被触发。
import { Component, h } from '@stencil/core';
@Component({
tag: 'my-component',
shadow: true
})
export class MyComponent {
handleClick(event: UIEvent) {
alert('Received the button click!');
}
render() {
return (
<button onClick={ (event: UIEvent) => this.handleClick(event)}>Click Me!</button>
);
}
}
-index.html代码-
<my-component></my-component>
答案 0 :(得分:1)
如果您的浏览器遇到ES6语法问题,您可以尝试使用Polyfills。
npm run build --es5