合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
[TOC] ## 用 js 生成标签 ``` <user-card></user-card> <script> class UserCard extends HTMLElement{ constructor(){ super(); let image = document.createElement('img'); image.src = 'https://semantic-ui.com/images/avatar2/large/kristy.png'; image.classList.add('image'); let container = document.createElement('div'); container.classList.add('container'); let name = document.createElement('p'); name.classList.add('name'); name.innerText = 'User Name'; let email = document.createElement('p'); email.classList.add('email'); email.innerText = 'yourmail@some-email.com'; let button = document.createElement('button'); button.classList.add('button'); button.innerText = 'Follow'; container.append(name, email, button); this.append(image, container); } } window.customElements.define("user-card",UserCard); </script> ```