普通子元素 2. shadow-DOM custom-events 使用各种自定义事件辅助完成组件之间的通讯 ES-module 为浏览器原生支持的模块化的一种方案,直接在浏览器里使用import和export placholder="put password" type="password" /> <form-login /> </form> </body> ` }) custom-events 因为是纯原生的版本,所以天然的支持addEventListener,我们可以直接使用custom-events来完成组件之间的通讯。 参考资料 shadow-DOM | MDN custom-elements | MDN custom-events | MDN ES-module | MDN 文中所有示例的仓库地址 仓库地址
-- CustomEventHandling.razor -->