【问题标题】:Putting a comma between tags of the scss在 scss 的标签之间加逗号
【发布时间】:2019-08-04 05:02:48
【问题描述】:

所以我在头文件中有以下代码:

<div class='topic-poster'>
  <a href="/u/${username}" data-user-card="${username}">
    <img alt="" width="50" height="50" src="${avatar}" class="avatar">
  </a>
</div>

....

<div class="topic-statuses">
    <a href="/t/${slug}/${id}" class="title raw-link raw-topic-link">${title}</a>
    <div class="topic-post-tags">${tags}</div>
</div>

在scss文件中:

.topic-statuses{
  margin-right: 50px;
}

输出是:

第一个和第二个是标签(${tag})。 如何添加逗号或“|”在第一和第二之间?

【问题讨论】:

  • 什么是第一,什么是第二?
  • @connexo 它们只是${tags} 使用的标签。

标签: javascript css sass


【解决方案1】:

尝试在两个带有 , 的元素之间插入另一个 div 容器。

 <div class='topic-poster'>
     <a href="/u/${username}" data-user-card="${username}">
       <img alt="" width="50" height="50" src="${avatar}" class="avatar">
     </a>
 </div>

<div> , </div>

<div class="topic-statuses">
    <a href="/t/${slug}/${id}" class="title raw-link raw-topic-link">${title}</a>
    <div class="topic-post-tags">${tags}</div>
</div>

【讨论】:

  • 他们不在同一个地方通过,解决不了。
  • hmm,那么您将不得不使用内置元素之间的逗号构建标签字符串。
  • 标签不是 tags='firstseondthirdfourth',而是这样构造:tags='first,seond,third,fourth'
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-02-22
  • 1970-01-01
  • 2014-12-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-20
相关资源
最近更新 更多