99re热视频这里只精品,久久久天堂国产精品女人,国产av一区二区三区,久久久精品成人免费看片,99久久精品免费看国产一区二区三区

多變量或maps

2018-02-24 15:11 更新

使用 maps 比使用多個不同的變量有明顯優(yōu)勢。最重要的優(yōu)勢就是 map 的遍歷功能,這在多個不同變量中是不可能實現(xiàn)的。

另一個支持使用 map 的原因,是它可以創(chuàng)建?map-get()?函數以提供友好 API 的功能。比如,思考一下下述 Sass 代碼:

/// Z-indexes map, gathering all Z layers of the application
/// @access private
/// @type Map
/// @prop {String} key - Layer's name
/// @prop {Number} value - Z value mapped to the key
$z-indexes: (
  'modal': 5000,
  'dropdown': 4000,
  'default': 1,
  'below': -1,
);

/// Get a z-index value from a layer name
/// @access public
/// @param {String} $layer - Layer’s name
/// @return {Number}
/// @require $z-indexes
@function z($layer) {
  @return map-get($z-indexes, $layer);
}
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號