variable.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // 超出行数,自动显示行尾省略号,最多5行
  2. // 来自uvui的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】
  3. @if variable-exists(show-lines) {
  4. @for $i from 1 through 5 {
  5. .uv-line-#{$i} {
  6. /* #ifdef APP-NVUE */
  7. // nvue下,可以直接使用lines属性,这是weex特有样式
  8. lines: $i;
  9. text-overflow: ellipsis;
  10. overflow: hidden;
  11. flex: 1;
  12. /* #endif */
  13. /* #ifndef APP-NVUE */
  14. // vue下,单行和多行显示省略号需要单独处理
  15. @if $i == '1' {
  16. overflow: hidden;
  17. white-space: nowrap;
  18. text-overflow: ellipsis;
  19. } @else {
  20. display: -webkit-box!important;
  21. overflow: hidden;
  22. text-overflow: ellipsis;
  23. word-break: break-all;
  24. -webkit-line-clamp: $i;
  25. -webkit-box-orient: vertical!important;
  26. }
  27. /* #endif */
  28. }
  29. }
  30. }
  31. @if variable-exists(show-border) {
  32. $uv-bordercolor: #dadbde;
  33. @if variable-exists(uv-border-color) {
  34. $uv-bordercolor: $uv-border-color;
  35. }
  36. // 此处加上!important并非随意乱用,而是因为目前*.nvue页面编译到H5时,
  37. // App.vue的样式会被uni-app的view元素的自带border属性覆盖,导致无效
  38. // 综上,这是uni-app的缺陷导致我们为了多端兼容,而必须要加上!important
  39. // 移动端兼容性较好,直接使用0.5px去实现细边框,不使用伪元素形式实现
  40. @if variable-exists(show-border-surround) {
  41. .uv-border {
  42. border-width: 0.5px!important;
  43. border-color: $uv-bordercolor!important;
  44. border-style: solid;
  45. }
  46. }
  47. @if variable-exists(show-border-top) {
  48. .uv-border-top {
  49. border-top-width: 0.5px!important;
  50. border-color: $uv-bordercolor!important;
  51. border-top-style: solid;
  52. }
  53. }
  54. @if variable-exists(show-border-left) {
  55. .uv-border-left {
  56. border-left-width: 0.5px!important;
  57. border-color: $uv-bordercolor!important;
  58. border-left-style: solid;
  59. }
  60. }
  61. @if variable-exists(show-border-right) {
  62. .uv-border-right {
  63. border-right-width: 0.5px!important;
  64. border-color: $uv-bordercolor!important;
  65. border-right-style: solid;
  66. }
  67. }
  68. @if variable-exists(show-border-bottom) {
  69. .uv-border-bottom {
  70. border-bottom-width: 0.5px!important;
  71. border-color: $uv-bordercolor!important;
  72. border-bottom-style: solid;
  73. }
  74. }
  75. @if variable-exists(show-border-top-bottom) {
  76. .uv-border-top-bottom {
  77. border-top-width: 0.5px!important;
  78. border-bottom-width: 0.5px!important;
  79. border-color: $uv-bordercolor!important;
  80. border-top-style: solid;
  81. border-bottom-style: solid;
  82. }
  83. }
  84. }
  85. @if variable-exists(show-reset-button) {
  86. // 去除button的所有默认样式,让其表现跟普通的view、text元素一样
  87. .uv-reset-button {
  88. padding: 0;
  89. background-color: transparent;
  90. /* #ifndef APP-PLUS */
  91. font-size: inherit;
  92. line-height: inherit;
  93. color: inherit;
  94. /* #endif */
  95. /* #ifdef APP-NVUE */
  96. border-width: 0;
  97. /* #endif */
  98. }
  99. /* #ifndef APP-NVUE */
  100. .uv-reset-button::after {
  101. border: none;
  102. }
  103. /* #endif */
  104. }
  105. @if variable-exists(show-hover) {
  106. .uv-hover-class {
  107. opacity: 0.7;
  108. }
  109. }