Web Components是浏览器原生支持的组件化标准。
Custom Elements
class MyButton extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
}
customElements.define('my-button', MyButton);Shadow DOM
Shadow DOM提供样式隔离。
Web Components是浏览器原生支持的组件化标准。
class MyButton extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
}
customElements.define('my-button', MyButton);Shadow DOM提供样式隔离。
评论 (0)
暂无评论,来发表第一条评论吧!
发表评论