mixins中的参数太多

时间:2018-09-06 16:44:34

标签: pug

嘿,伙计们!有人可以在这里给我一点帮助吗? 我的mixins接受了太多参数= /

示例:

// file 01:

mixin rm-projects-home__project-item(obj)
  li.rm-projects-home__project-item

    a(class!=[obj.defaultClass, obj.side] href=obj.href alt='Link para a página do projeto')
    div.rm-project-img-hover
      span.rm-project-img-hover__symbol +
    img.rm-projects-home__project-img(src!=obj.imgSrc, alt!=obj.imgAlt)

    div(class!=[obj.projectTitle, obj.textSide])
      p.rm-category.rm-category__projects-home
        span.rm-category__icon.rm-category__icon-projects-home # 
        | #{obj.role}
      h3.rm-projects-home__project-title= obj.projectName


// file 02: 

ul.rm-projects-home__list
  include ../components/projects-home__project-item.pug
  +rm-projects-home__project-item({
    defaultClass: 'rm-projects-home__project-link',
    projectTitle: 'rm-projects-home__title-container',
    href: '#',
    imgSrc: './assets/img/roger-melo-website-thumb.jpg',
    imgAlt: 'Imagem de uma parte do website de Roger Melo',
    projectName: 'My Website',
    role: 'Front-end development'
  })

我该如何写得更好?

0 个答案:

没有答案