/* 获取直属子元素 */ function getChildren(el, className) { for (let item of el.children) if (item.className === className) return item; return null; } // 跳转链接的卡片 document.addEventListener("DOMContentLoaded", () => { customElements.define( "hao-introduction-card", class HaoIntroductionCard extends HTMLElement { constructor() { super(); this.options = { link: this.getAttribute("link") || 'https://0206.ink/', img: this.getAttribute("img"), tip: this.getAttribute("tip") || '小标题', cardTitle: this.getAttribute("cardTitle") || '标题', logo: this.getAttribute("logo"), title: this.getAttribute("title"), subTitle: this.getAttribute("subTitle"), }; let style1 = '' let style2 = '' if(this.options.logo==null && this.options.title==null && this.options.subTitle==null){ style1 = 'height:416px' style2 = 'height:100%;border-radius:15px' } let innerHTMLs = `
${$1}
${$2
.trim()
.replace(/^(
)|(
)$/g, "")}
${str[1]}
${str[1]}
${str[1]}