TrainingItem.js 686 B

123456789101112131415161718192021222324
  1. class TrainingItem {
  2. constructor () {}
  3. static createElement(data){
  4. let d = document.createElement('div');
  5. d.innerHTML = Training.createHTMLString(data);
  6. return d.childNodes[0];
  7. }
  8. static createHTMLString(data){
  9. return `
  10. <div class="training-item-frame">
  11. <img src="${data.img}" alt="" />
  12. <div class="training-new" style="display:${data.isNew ? 'block' : 'none'};"></div>
  13. <div class="training-desc">
  14. <p class="subject">${data.subject}</p>
  15. <p class="subject-sub">${data.subjectSub}</p>
  16. </div>
  17. </div>
  18. `;
  19. }
  20. }
  21. module.exports = TrainingItem;