在尝试stenciljs文档- https://stenciljs.com/docs/templating-jsx中的示例代码时,我遇到了一个问题。单击事件处理程序根本不会被触发。
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>发布于 2019-10-29 17:36:40
如果您的浏览器在ES6语法方面有问题,可以尝试使用Polyfills。
npm run build --es5 https://stackoverflow.com/questions/58151939
复制相似问题