Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用变量作为键来定义地图?
示例代码
$types: ( 'INPUT': 1, 'SELECT': 2, 'BUTTON': 3, ); $colors: ( $types['INPUT'] : #f44336, $types['SELECT']: #2196f3, $types['BUTTON']: #9c27b0, );
我发现了怎么做
@function type($key) { @return map-get($types, $key); } $colors: ( type('INPUT'): #f44336, type('SELECT'): #2196f3, type('BUTTON'): #9c27b0, }