gpt4 book ai didi

css - 手写笔如何实现循环?

转载 作者:行者123 更新时间:2023-11-28 05:07:06 25 4
gpt4 key购买 nike

美好的一天。有一个对象类名和图标的路径。

currentProject = {'current-project': '../../sprites/123.png',
'composition-project': '../../sprites/123.png',
'room': '../../sprites/123.png',
'terms': '../../sprites/123.png',
'documents': '../../sprites/123.png',
'command': '../../sprites/123.png',
'contact': '../../sprites/123.png'}


如何得到结果?

 &__current-project: 
background-image: url('../../sprites/123.png')
&__room
background-image: url('../../sprites/123.png')

最佳答案

在手写笔中使用迭代语法 for [, ] in

currentProject = {'current-project': '../../sprites/123.png',
'composition-project': '../../sprites/123.png',
'room': '../../sprites/123.png',
'terms': '../../sprites/123.png',
'documents': '../../sprites/123.png',
'command': '../../sprites/123.png',
'contact': '../../sprites/123.png'}

div
for k, v in currentProject
&_{k}
background-image v

输出应该是

div_current-project {
background-image: '../../sprites/123.png';
}
...

关于css - 手写笔如何实现循环?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39781828/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com