common.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. @import './variable.scss';
  2. /** 背景颜色 */
  3. .zh-bg-success {
  4. background-color: $zh-green;
  5. }
  6. .zh-bg-gray {
  7. background-color: $zh-light-gray;
  8. }
  9. .zh-bg-blue {
  10. background-color: $zh-blue;
  11. }
  12. .zh-bg-red {
  13. background-color: $zh-red;
  14. }
  15. .zh-bg-yellow {
  16. background-color: $zh-yellow;
  17. }
  18. .zh-bg-green {
  19. background-color: $zh-green;
  20. }
  21. .zh-bg-white {
  22. background-color: $zh-white;
  23. }
  24. /** 字体颜色 */
  25. .zh-gray {
  26. color: $zh-gray;
  27. }
  28. .zh-red {
  29. color: $zh-red;
  30. }
  31. .zh-blue {
  32. color: $zh-blue;
  33. }
  34. .zh-green {
  35. color: $zh-green;
  36. }
  37. .zh-yellow {
  38. color: $zh-yellow;
  39. }
  40. .zh-muted {
  41. color: $zh-muted;
  42. }
  43. /** 文本水平对齐方向 */
  44. .zh-text-center {
  45. text-align: center;
  46. }
  47. .zh-text-left {
  48. text-align: left;
  49. }
  50. .zh-text-right {
  51. text-align: right;
  52. }
  53. .zh-width-100P {
  54. width: 100%;
  55. }
  56. .zh-height-100P {
  57. height: 100%;
  58. }
  59. /** 字体粗细 */
  60. @for $i from 1 through 9 {
  61. .zh-fw-#{$i * 100} {
  62. font-weight: $i * 100;
  63. }
  64. }
  65. /* 预设常用样式 */
  66. @for $i from 1 through 50 {
  67. /* font-size */
  68. .zh-fz-#{$i} {
  69. font-size: 1px * $i;
  70. }
  71. /* padding */
  72. .zh-pd-#{$i} {
  73. padding: 1px * $i;
  74. }
  75. .zh-pd-top-#{$i} {
  76. padding-top: 1px * $i;
  77. }
  78. .zh-pd-right-#{$i} {
  79. padding-right: 1px * $i;
  80. }
  81. .zh-pd-bottom-#{$i} {
  82. padding-bottom: 1px * $i;
  83. }
  84. .zh-pd-left-#{$i} {
  85. padding-left: 1px * $i;
  86. }
  87. .zh-pd-tb-#{$i} {
  88. padding-top: 1px * $i;
  89. padding-bottom: 1px * $i;
  90. }
  91. .zh-pd-lr-#{$i} {
  92. padding-right: 1px * $i;
  93. padding-left: 1px * $i;
  94. }
  95. /* margin */
  96. .zh-mg-#{$i} {
  97. margin: 1px * $i;
  98. }
  99. .zh-mg-top-#{$i} {
  100. margin-top: 1px * $i;
  101. }
  102. .zh-mg-right-#{$i} {
  103. margin-right: 1px * $i;
  104. }
  105. .zh-mg-bottom-#{$i} {
  106. margin-bottom: 1px * $i;
  107. }
  108. .zh-mg-left-#{$i} {
  109. margin-left: 1px * $i;
  110. }
  111. .zh-mg-tb-#{$i} {
  112. margin-top: 1px * $i;
  113. margin-bottom: 1px * $i;
  114. }
  115. .zh-mg-lr-#{$i} {
  116. margin-right: 1px * $i;
  117. margin-left: 1px * $i;
  118. }
  119. // width & height
  120. .zh-width-#{$i} {
  121. width: 1px * $i;
  122. }
  123. .zh-height-#{$i} {
  124. height: 1px * $i;
  125. }
  126. // radius
  127. .zh-radius-#{$i} {
  128. border-radius: 1px * $i;
  129. }
  130. // line-height
  131. .zh-lh-#{$i} {
  132. line-height: 1px * $i;
  133. }
  134. }
  135. /** flex布局 */
  136. .zh-flex {
  137. display: flex;
  138. }
  139. .zh-flex-wrap {
  140. @extend .zh-flex;
  141. flex-wrap: wrap;
  142. }
  143. .zh-flex-row {
  144. @extend .zh-flex;
  145. flex-direction: row;
  146. }
  147. .zh-flex-column {
  148. @extend .zh-flex;
  149. flex-direction: column;
  150. }
  151. .zh-flex-sub {
  152. flex: 1;
  153. }
  154. .zh-flex-twice {
  155. flex: 2;
  156. }
  157. .zh-flex-treble {
  158. flex: 3;
  159. }
  160. .zh-flex-quadruple {
  161. flex: 4;
  162. }
  163. .zh-flex-quintuple {
  164. flex: 5;
  165. }
  166. .zh-align-start {
  167. @extend .zh-flex;
  168. align-items: flex-start;
  169. }
  170. .zh-align-end {
  171. @extend .zh-flex;
  172. align-items: flex-end;
  173. }
  174. .zh-align-center {
  175. @extend .zh-flex;
  176. align-items: center;
  177. }
  178. .zh-align-stretch {
  179. @extend .zh-flex;
  180. align-items: stretch;
  181. }
  182. .zh-align-baseline {
  183. @extend .zh-flex;
  184. align-items: baseline;
  185. }
  186. .zh-self-start {
  187. @extend .zh-flex;
  188. align-self: flex-start;
  189. }
  190. .zh-self-center {
  191. @extend .zh-flex;
  192. align-self: flex-center;
  193. }
  194. .zh-self-end {
  195. @extend .zh-flex;
  196. align-self: flex-end;
  197. }
  198. .zh-self-stretch {
  199. @extend .zh-flex;
  200. align-self: stretch;
  201. }
  202. .zh-justify-start {
  203. @extend .zh-flex;
  204. justify-content: flex-start;
  205. }
  206. .zh-justify-end {
  207. @extend .zh-flex;
  208. justify-content: flex-end;
  209. }
  210. .zh-justify-center {
  211. @extend .zh-flex;
  212. justify-content: center;
  213. }
  214. .zh-justify-between {
  215. @extend .zh-flex;
  216. justify-content: space-between;
  217. }
  218. .zh-justify-around {
  219. @extend .zh-flex;
  220. justify-content: space-around;
  221. }
  222. .zh-flex-row-center {
  223. @extend .zh-flex-row;
  224. @extend .zh-justify-center;
  225. @extend .zh-align-center;
  226. }
  227. .zh-flex-column-center {
  228. @extend .zh-flex-column;
  229. @extend .zh-justify-center;
  230. @extend .zh-align-center;
  231. }
  232. // grid布局
  233. .zh-grid {
  234. display: flex;
  235. flex-wrap: wrap;
  236. }
  237. @mixin multi-border($n) {
  238. &.zh-grid-border {
  239. & > div {
  240. @include zh-border;
  241. &:not(:nth-last-child(-n + #{$n})) {
  242. &::after {
  243. border-bottom: 1px solid $zh-line-color;
  244. }
  245. }
  246. &:not(:nth-child(#{$n}n)) {
  247. &::after {
  248. border-right: 1px solid $zh-line-color;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. .zh-grid.zh-col-2 {
  255. & > div {
  256. width: 50%;
  257. }
  258. @include multi-border(2);
  259. }
  260. .zh-grid.zh-col-3 {
  261. & > div {
  262. width: calc(100% / 3);
  263. }
  264. @include multi-border(3);
  265. }
  266. @mixin space-calc($i, $n) {
  267. & > div {
  268. width: calc((100% - #{($n - 1) * $i}px) / #{$n});
  269. &:not(:nth-last-child(-n + #{$n})) {
  270. margin-bottom: #{$i}px;
  271. }
  272. &:not(:nth-child(#{$n}n)) {
  273. margin-right: #{$i}px;
  274. }
  275. }
  276. }
  277. // 处理列之间需要有空隙情况
  278. @for $i from 1 through 50 {
  279. .zh-grid.zh-col-1.zh-col-space-#{$i} {
  280. & > div {
  281. margin-bottom: #{$i}px;
  282. }
  283. }
  284. .zh-grid.zh-col-2.zh-col-space-#{$i} {
  285. @include space-calc($i, 2);
  286. }
  287. .zh-grid.zh-col-3.zh-col-space-#{$i} {
  288. @include space-calc($i, 3);
  289. }
  290. .zh-grid.zh-col-4.zh-col-space-#{$i} {
  291. @include space-calc($i, 4);
  292. }
  293. .zh-grid.zh-col-5.zh-col-space-#{$i} {
  294. @include space-calc($i, 5);
  295. }
  296. .zh-grid.zh-col-6.zh-col-space-#{$i} {
  297. @include space-calc($i, 6);
  298. }
  299. }
  300. /** 省略号 */
  301. @for $i from 1 through 2 {
  302. .zh-ellipsis-#{$i} {
  303. display: -webkit-box;
  304. -webkit-box-orient: vertical;
  305. -webkit-line-clamp: #{$i};
  306. overflow: hidden;
  307. }
  308. }
  309. /** 鼠标手 */
  310. .zh-pointer {
  311. cursor: pointer;
  312. }
  313. /** 线条 */
  314. @for $i from 1 through 5 {
  315. .zh-border-top-#{$i} {
  316. border-top: 1px * $i solid #f3f3f3;
  317. }
  318. }
  319. /** 布局 */
  320. .wrap-container {
  321. @extend .zh-width-100P;
  322. @extend .zh-height-100P;
  323. position: absolute;
  324. top: 0;
  325. left: 0;
  326. overflow: hidden;
  327. background: white;
  328. }
  329. /** 滚动条自定义 */
  330. ::-webkit-scrollbar{
  331. width: 8px;
  332. height: 8px;
  333. }
  334. ::-webkit-scrollbar-track{
  335. background: rgb(239, 239, 239);
  336. border-radius: 2px;
  337. }
  338. ::-webkit-scrollbar-thumb{
  339. background: #bfbfbf;
  340. border-radius: 10px;
  341. }
  342. ::-webkit-scrollbar-thumb:hover{
  343. background: #636363;
  344. }