鉴于以下BEM树结构,设有五个嵌套级别存在:如何使用BEM正确设置元素的范围?
collection-main__features-top__story__byline__author
根据BEM的命名约定,其中一个元素是块的组成部分,它属于,什么是块外没有任何意义命名author
类的正确方法?
由于一个author
在语义绑在byline
和story
范围内,但毫无意义下的features-top
和collection-main
块,什么是最好的BEM的名字吗?
collection-main__author
features-top__author
story__author (best?)
story__byline__author
byline__author
如果引入新的features
块会发生什么情况?
collection-main__features-top__story__byline__author (target)
collection-main__features-bottom__story__byline__author
features-top__story__author
story--features-top__author (best?)
最后,如果另一collection
块被添加时会发生什么,我们希望在样式列表中的第二个author元素?
collection-main__features-top__story__byline__author
collection-main__features-bottom__story__byline__author (target)
collection-sub__features-top__story__byline__author
collection-sub__features-bottom__story__byline__author
我们会这样做吗?
story--collection-main--features-bottom__author
必须有更好的选择。
请显示您的数据输出。是否像 '{collection-main:[{“feature-item”:{story:{author:''}}}]}'? –