// 标题背景 .bg_title { background-size: contain; background-repeat: no-repeat; height: 14px; margin-left: 8px; } // 标题图 @for $i from 0 through 6 { // 生成动态类名 .bg_title_#{$i} { // 动态设置背景图片,引用对应的图标 background-image: url("@/assets/header/title#{$i}.png"); } }