You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.5 KiB

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