Yo 源文件
Yo 是一款基于 Mobile First 理念而设计的 CSS Framework,当然,它也适应于PC端的高级浏览器;其具备轻量,易用,快速且高度强大的自定义能力
Yo 是一款基于 Mobile First 理念而设计的 CSS Framework,当然,它也适应于PC端的高级浏览器;其具备轻量,易用,快速且高度强大的自定义能力
@charset "utf-8"; @import "../element/yo-btn"; // 定义dialog的基础构造 @mixin _dialog { @include flexbox; @include flex-direction(column); position: fixed; overflow: hidden; z-index: map-get($z-index, dialog); @if map-get($dialog, shadow-opacity) != null { box-shadow: 0 0 5px rgba(map-get($dialog, border-color), map-get($dialog, shadow-opacity)); } @include border( $border-color: map-get($dialog, border-color), $radius: map-get($dialog, radius) ); min-width: 2.8rem; max-width: 90%; width: map-get($dialog, width); height: map-get($dialog, height); background: #fff; text-align: center; > .hd { position: relative; overflow: hidden; height: map-get($dialog, hd-height); background: map-get($dialog, hd-bgcolor); line-height: map-get($dialog, hd-height); .title { overflow: hidden; height: 100%; margin: 0 60px; color: map-get($dialog, title-color); font-size: map-get($dialog, title-font-size); } .regret, .affirm { position: absolute; top: 0; } .regret { left: .1rem; } .affirm { right: .1rem; } } > .bd { @include flex(1, column); @include overflow; min-height: .45rem; padding: map-get($dialog, bd-padding); font-size: map-get($dialog, bd-font-size); } > .ft { @include flexbox; text-align: center; @include yo-btn( $name: dialog, $border-width: 1px 1px 0 0, $border-color: map-get($dialog, border-color), $bgcolor: #fff, $color: map-get($base, link-color), $radius: 0, $active-bgcolor: #f9f9f9 ){ display: block; @include flex; &:last-child { font-weight: bold; &::after { border-right-width: 0; } } } } } /** * @module widget * @method yo-dialog * @version 1.0.0 * @description 构造yo-dialog的自定义使用方法 * @demo http://doyoe.github.io/Yo/demo/widget/yo-dialog.html * @param {String} $name 定义扩展名称 {add:1.0.0} * @param {Length} $width 宽度 {add:1.0.0} * @param {Length} $height 高度 {add:1.0.0} * @param {Length} $radius 圆角半径长度 {add:1.0.0} * @param {Number} $shadow-opacity 阴影透明度 {add:1.0.0} * @param {Color} $bordercolor 边框色 {add:1.0.0}{del:2.0.0} * @param {Color} $border-color 边框色 {add:2.0.0} * @param {Length} $hd-height 头部高度 {add:1.0.0} * @param {Color} $hd-bgcolor 头部背景色 {add:1.0.0} * @param {Color} $title-color 标题文本色 {add:1.0.0} * @param {Length} $title-font-size 标题字号 {add:1.0.0} * @param {Length} $bd-padding 主体内补白 {add:1.0.0} * @param {Length} $bd-font-size 主体字号 {add:1.0.0} */ @mixin yo-dialog( $name: default, $width: default, $height: default, $radius: default, $shadow-opacity: default, $border-color: default, $hd-height: default, $hd-bgcolor: default, $title-color: default, $title-font-size: default, $bd-padding: default, $bd-font-size: default) { // 区别是否新增实例还是修改本身 $name: if($name == default, "", "-#{$name}"); // 如果值为default,则取config的定义 @if $width == default { $width: map-get($dialog, width); } @if $height == default { $height: map-get($dialog, height); } @if $radius == default { $radius: map-get($dialog, radius); } @if $shadow-opacity == default { $shadow-opacity: map-get($dialog, shadow-opacity); } @if $border-color == default { $border-color: map-get($dialog, border-color); } @if $hd-height == default { $hd-height: map-get($dialog, hd-height); } @if $hd-bgcolor == default { $hd-bgcolor: map-get($dialog, hd-bgcolor); } @if $title-color == default { $title-color: map-get($dialog, title-color); } @if $title-font-size == default { $title-font-size: map-get($dialog, title-font-size); } @if $bd-padding == default { $bd-padding: map-get($dialog, bd-padding); } @if $bd-font-size == default { $bd-font-size: map-get($dialog, bd-font-size); } .yo-dialog#{$name} { @if $radius != map-get($dialog, radius) { border-radius: $radius; } &::after { // 如果$border-color不等于config设定,则重绘边框颜色 @if $border-color != map-get($dialog, border-color) { border-color: $border-color; } // 如果$radius不等于config设定,则重绘边框圆角 @if $radius != map-get($dialog, radius) { @include responsive(retina1x) { border-radius: $radius; } @include responsive(retina2x) { border-radius: $radius * 2; } @include responsive(retina3x) { border-radius: $radius * 3; } } } // 如果$border-color或者$shadow-opacity不等于config设定,都重绘边框颜色 @if $border-color != map-get($dialog, border-color) or $shadow-opacity != map-get($dialog, shadow-opacity) { box-shadow: 0 0 5px rgba($border-color, $shadow-opacity); } @if $width != map-get($dialog, width) { width: $width; } @if $height != map-get($dialog, height) { height: $height; } > .hd { @if $hd-height != map-get($dialog, hd-height) { height: $hd-height; line-height: $hd-height; } @if $hd-bgcolor != map-get($dialog, hd-bgcolor) { background: $hd-bgcolor; } .title { @if $title-color != map-get($dialog, title-color) { color: $title-color; } @if $title-font-size != map-get($dialog, title-font-size) { font-size: $title-font-size; } } } > .bd { @if $bd-padding != map-get($dialog, bd-padding) { padding: $bd-padding; } @if $bd-font-size != map-get($dialog, bd-font-size) { font-size: $bd-font-size; } } > .ft { .yo-btn-dialog::after { // 如果$border-color不等于config设定,则重绘边框颜色 @if $border-color != map-get($dialog, border-color) { border-color: $border-color; } } } // 增量扩展 @content; } } // 调用本文件时载入dialog基础构造 .yo-dialog { @include _dialog; }