我试图通过第一个属性获取嵌套SASS列表中的项索引。但我能得到结果的唯一方法是在项目中包含两个属性。嵌套列表中的SASS索引
是否可以与本地SASS配合使用,还是需要mixin/function?以及我如何做到这一点的任何输入?
代码中,我得到了:
$icons : (
'arrow--down--full' '\e806', /* '' */
'cog' '\e805', /* '' */
'info' '\e807', /* '' */
'arrow--down' '\e800', /* '' */
'arrow--left' '\e801', /* '' */
'arrow--right' '\e802', /* '' */
'arrow--up' '\e803', /* '' */
'close' '\e804', /* '' */
'search' '\e804', /* '' */
'spin' '\e809' /* '' */
);
而且我查找
//Working
index($icons, 'search' '\e804');
//Not working, but what i want to achieve
index($icons, 'search');
哪里是你的指数函数的代码? – cimmanon
[Access SASS multidimensional list key](http:// stackoverflow。com/questions/16995373/access-sass-multidimensional-list-key) – cimmanon
@cimmanon,索引函数是本机SASS:http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#index -instance_method –