如何解决应用多个类在Pug中占用多于一行的方法而无需复制属性
我想使用"disallowDuplicateAttributes" rule中的pug-lint,显然,该属性不允许重复。基本上,属性复制需要在我们需要应用多个长类名称时进行:
td(
class="ProductsManagementPage-ProductsTable-ProductsTableHeaderdecoration"
class="ProductsManagementPage-ProductsTable-ID_ColumnSizer"
class="ProductsManagementPage-ProductsTable-ID_Columndecoration"
)
还有哪些其他方法可能?
不允许的解决方案
- 将所有类都用类文字括起来,因为这会影响可维护性。另外,我将使用相同的pug-lint限制每行的列数。
td.ProductsManagementPage-ProductsTable-ProductsTableHeaderdecoration.ProductsManagementPage-ProductsTable-ID_ColumnSizer.ProductsManagementPage-ProductsTable-ID_Columndecoration
解决方法
束缚像这样的课程:
td.ProductsManagementPage-ProductsTable-ProductsTableHeaderDecoration.ProductsManagementPage-ProductsTable-ID_ColumnSizer.ProductsManagementPage-ProductsTable-ID_ColumnDecoration
,
可以通过attributes literal指定类的数组。超长类可以通过字符串污染来分割:
td&attributes({
class: [
"ProductsManagementPage-ProductsTable-ProductsTableHeaderDecoration","ProductsManagementPage-" +
"ProductsTable-ID_ColumnSizer","ProductsManagementPage-ProductsTable-ID_ColumnDecoration"
]
}) 有
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。