resume-wizard / components /resume-section.js
hepansls's picture
你需要从本地路径读取json数据,例如resume.json,而不是直接展示resume_dict,resume_dict只是一个示例。
9bc6cc2 verified
class ResumeSection extends HTMLElement {
connectedCallback() {
const title = this.getAttribute('title') || '';
const icon = this.getAttribute('icon') || 'file';
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.section-title {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1.5rem;
color: #4f46e5;
}
.section-title h2 {
font-size: 1.25rem;
font-weight: 600;
margin: 0;
}
.section-icon {
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
background-color: #eef2ff;
border-radius: 50%;
}
</style>
<section class="resume-section">
<div class="section-title">
<div class="section-icon">
<i data-feather="${icon}"></i>
</div>
<h2>${title}</h2>
</div>
<div class="section-content">
<slot></slot>
</div>
</section>
`;
}
}
customElements.define('resume-section', ResumeSection);