Yo : ./lib/element/yo-score.scss
源代码
源代码
@charset "utf-8"; // 定义score的基础构造 @mixin _score { position: relative; width: map-get($score, item-width) * 5; height: map-get($score, item-height); overflow: hidden; &, > .index { display: inline-block; background: url(#{map-get($setting, bgimg-domain)}#{map-get($score, url)}) repeat-x; background-size: auto 200%; } > .index { height: 100%; background-position: 0 100%; line-height: 10; vertical-align: top; } } /** * @module element * @method yo-score * @version 1.3.1 * @description 构造评分展示的自定义使用方法 * @demo http://doyoe.github.io/Yo/demo/element/yo-score.html * @param {String} $name 定义扩展名称 <1.3.1> * @param {Length} $item-width 单项宽度(指定尺寸时,宽高的比例需要和图片原始比例保持一致) <1.3.1> * @param {Length} $item-height 单项高度(指定尺寸时,宽高的比例需要和图片原始比例保持一致) <1.3.1> * @param {String} $url 背景图片url <1.3.1> */ @mixin yo-score( $name: default, $item-width: default, $item-height: default, $url: default) { // 区别是否新增实例还是修改本身 $name: if($name == default, "", "-#{$name}"); // 如果值为default,则取config的定义 @if $item-width == default { $item-width: map-get($score, item-width); } @if $item-height == default { $item-height: map-get($score, item-height); } @if $url == default { $url: map-get($score, url); } .yo-score#{$name} { @if $item-width != map-get($score, item-width) { width: $item-width * 5; } @if $item-height != map-get($score, item-height) { height: $item-height; } &, > .index { @if $url != map-get($score, url) { background-image: url(#{map-get($setting, bgimg-domain)}#{$url}); } } // 增量扩展 @content; } } // 调用本文件时载入score基础构造 .yo-score { @include _score; }