企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[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> ```