鑑於以下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:''}}}]}'? –