Skip to content

Commit

Permalink
1. 三角形方法中的 IE6/7 hack 加入变量控制;2. 废弃部分 flex 属性;
Browse files Browse the repository at this point in the history
  • Loading branch information
kayo5994 committed Jun 8, 2017
1 parent 93a3bc5 commit 07a786d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
5 changes: 0 additions & 5 deletions qmui/helper/mixin/_compatible.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
/// @group 布局
/// @name flex
%flex {
display: -o-box;
display: -moz-box;
display: -webkit-box;
display: box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
Expand All @@ -27,10 +25,8 @@
/// @group 布局
/// @name display-flex
@mixin display-flex {
display: -o-box;
display: -moz-box;
display: -webkit-box;
display: box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
Expand Down Expand Up @@ -299,7 +295,6 @@
height: $lineHeight * $line;
display: -webkit-box;
display: -moz-box;
display: box;
text-overflow: ellipsis;
-webkit-line-clamp: $line;
-moz-line-clamp: $line;
Expand Down
44 changes: 27 additions & 17 deletions qmui/helper/mixin/tool/_effect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

////
/// 辅助编写样式效果的工具方法
/// @author Kayo
/// @author Kayo
/// @group 样式特效
/// @date 2015-08-23
////
Expand All @@ -11,7 +11,7 @@
/// 产生正方形的宽高
///
/// @name square
/// @param {Measure} $length - 宽高的长度
/// @param {Measure} $length - 宽高的长度
@mixin square($length){
width: $length;
height: $length;
Expand All @@ -20,13 +20,13 @@
/// 利用 absolute 把指定元素水平垂直居中布局,适用于已知元素宽高的情况下
///
/// @name absoluteCenter
/// @param {Measure} $width - 元素的宽度
/// @param {Measure} $height - 元素的高度
/// @param {Measure} $width - 元素的宽度
/// @param {Measure} $height - 元素的高度
@mixin absoluteCenter($width, $height){
position: absolute;
left: 50%;
top: 50%;
margin: (-$height)/2 0 0 (-$width)/2;
margin: (-$height)/2 0 0 (-$width)/2;
}

%triangleCommonStyle {
Expand All @@ -42,43 +42,53 @@
/// CSS Border 三角形
///
/// @name triangle
/// @param {Measure} $width - 三角形的底边的宽
/// @param {Measure} $height - 三角形的高
/// @param {String} $direction - 三角形的方向(即与底边相对的顶点指向的方向)
/// @param {Measure} $width - 三角形的底边的宽
/// @param {Measure} $height - 三角形的高
/// @param {String} $direction - 三角形的方向(即与底边相对的顶点指向的方向)
/// @param {Color} $borderColor - 三角形的边框色
/// @param {Color} $ie6borderColor [#f00] - IE6 不支持 border-color: transparent,而 border 三角形利用了这个特性,因此如果需要兼容 IE6,则需要填写 $ie6borderColor,颜色值一般为三角形背后元素的颜色。
/// @param {Color} $ie6borderColor [#f00] - IE6 不支持 border-color: transparent,而 border 三角形利用了这个特性,因此如果需要兼容 IE6,则需要填写 $ie6borderColor,颜色值一般为三角形背后元素的颜色。
/// @throw 由于方法内包含了有 $width / 2 的计算,因此如果 $width 的值为奇数,则实际上计算出的三角形会偏小,建议 $width 不要使用奇数。
@mixin triangle($width, $height, $direction, $borderColor, $ie6borderColor:#f00) {
@extend %triangleCommonStyle;
_border-color: $ie6borderColor;
_filter: chroma(color=$ie6borderColor);
@if not($function_mobileOnly) {
_border-color: $ie6borderColor;
_filter: chroma(color=$ie6borderColor);
}
/* 向上小三角 */
@if $direction == top {
border-width: $height $width / 2;
border-top: 0;
border-bottom-color: $borderColor;
_border-bottom-color: $borderColor;
@if not($function_mobileOnly) {
_border-bottom-color: $borderColor;
}
}
/* 向下小三角 */
@else if $direction == bottom {
border-width: $height $width / 2;
border-bottom: 0;
border-top-color: $borderColor;
_border-top-color: $borderColor;
@if not($function_mobileOnly) {
_border-top-color: $borderColor;
}
}
/* 向左小三角 */
@else if $direction == left {
border-width: $width / 2 $height ;
border-left: 0;
border-right-color: $borderColor;
_border-right-color: $borderColor;
@if not($function_mobileOnly) {
_border-right-color: $borderColor;
}
}
/* 向右小三角 */
@else if $direction == right {
border-width: $width / 2 $height;
border-right: 0;
border-left-color: $borderColor;
_border-left-color: $borderColor;
@if not($function_mobileOnly) {
_border-left-color: $borderColor;
}
}
}

Expand Down Expand Up @@ -115,7 +125,7 @@

/// 使得指定的元素产生 Block Formatting Contexts 或 hasLayout
///
/// @name bfc
/// @name bfc
@mixin bfc {
overflow: hidden;
zoom: 1;
Expand All @@ -124,7 +134,7 @@
// borderStyleForOnePixel 是 onePixelBorder 内部使用的方法
@mixin borderStyleForOnePixel($direction: all, $color:#dedede){
border-style: solid;
border-color: $color;
border-color: $color;
@if $direction == all {
border-width: 1px;
}
Expand Down

0 comments on commit 07a786d

Please sign in to comment.