RouterTab.scss 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. // 变量
  2. $color-primary: #409eff;
  3. // 页签
  4. .router-tab {
  5. $bgHover: #f5f5f5;
  6. $bgActive: #e5e5e5;
  7. $h: 32px;
  8. $slideW: 15px;
  9. display: flex;
  10. flex-direction: column;
  11. &-header {
  12. position: relative;
  13. z-index: 9;
  14. border-bottom: 2px solid $color-primary;
  15. box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
  16. transition: all .2s ease-in-out;
  17. flex: none;
  18. &.is-scroll {
  19. padding: 0 $slideW;
  20. .nav-prev,
  21. .nav-next {
  22. display: block;
  23. }
  24. .router-tab-scroll {
  25. overflow: hidden;
  26. }
  27. }
  28. }
  29. &-scroll {
  30. overflow: visible;
  31. }
  32. &-nav {
  33. position: relative;
  34. margin: 0;
  35. padding: 0;
  36. display: inline-block;
  37. white-space: nowrap;
  38. }
  39. // 页签项
  40. &-item {
  41. $color: #4d4d4d;
  42. $borderColor: #e6e6e6;
  43. position: relative;
  44. display: inline-block;
  45. margin-right: -1px;
  46. padding: 0 20px 0 10px;
  47. color: $color;
  48. line-height: $h;
  49. font-size: 13px;
  50. border: 1px solid $borderColor;
  51. border-bottom: none;
  52. cursor: pointer;
  53. transition: all .3s ease-in-out;
  54. user-select: none;
  55. &.actived {
  56. background-color: $color-primary;
  57. border-color: $color-primary;
  58. color: #fff;
  59. .tab-close {
  60. background-image: url(../icon/close-active.png);
  61. }
  62. }
  63. &:not(.actived) {
  64. &:hover,
  65. &.contextmenu {
  66. color: #000;
  67. background-color: $bgHover;
  68. box-shadow: 0 -2px 4px rgba(0,0,0,.08);
  69. }
  70. &:active {
  71. background-color: $bgActive;
  72. }
  73. }
  74. .tab-title {
  75. display: inline-block;
  76. max-width: 100px;
  77. min-width: 30px;
  78. vertical-align: top;
  79. white-space: nowrap;
  80. text-overflow: ellipsis;
  81. overflow: hidden;
  82. }
  83. .tab-icon {
  84. margin-right: 5px;
  85. vertical-align: top;
  86. font-size: 16px;
  87. line-height: $h;
  88. }
  89. .tab-close {
  90. $size: 16px;
  91. $font-size: 12px;
  92. position: absolute;
  93. top: 1px;
  94. right: 1px;
  95. width: $size;
  96. height: $size;
  97. text-align: center;
  98. font-size: $font-size;
  99. border-radius: 50%;
  100. background: {
  101. image: url(../icon/close.png);
  102. position: 50% 50%;
  103. repeat: no-repeat;
  104. }
  105. transition: background-color .2s ease-in-out;
  106. &::before {
  107. line-height: $size;
  108. }
  109. &:hover {
  110. background-color: rgba(0,0,0,.1);
  111. }
  112. &:active {
  113. background-color: rgba(0,0,0,.2);
  114. }
  115. }
  116. }
  117. .nav-prev,
  118. .nav-next {
  119. display: none;
  120. position: absolute;
  121. top: 0;
  122. width: $slideW;
  123. height: 100%;
  124. line-height: $h;
  125. text-align: center;
  126. color: #ccc;
  127. background: {
  128. image: url(../icon/left.png);
  129. position: 40% 50%;
  130. repeat: no-repeat;
  131. }
  132. transition: all .2s ease-in-out;
  133. box-shadow: 0 0 4px rgba(0,0,0,.2);
  134. cursor: pointer;
  135. &:hover {
  136. color: #fff;
  137. background-image: url(../icon/left-hover.png);
  138. background-color: $color-primary;
  139. border-color: $color-primary;
  140. }
  141. &:active {
  142. opacity: .8;
  143. }
  144. }
  145. .nav-prev {
  146. left: 0;
  147. }
  148. .nav-next {
  149. right: 0;
  150. transform: rotate(180deg);
  151. }
  152. // 页面容器
  153. &-container {
  154. position: relative;
  155. flex: auto;
  156. overflow: hidden auto;
  157. background: #fff;
  158. transition: all .4s ease-in-out;
  159. }
  160. // 右键菜单
  161. &-contextmenu {
  162. position: fixed;
  163. z-index: 999;
  164. min-width: 120px;
  165. border-top: 2px solid $color-primary;
  166. font-size: 13px;
  167. background: #fff;
  168. box-shadow: 0 1px 6px 3px rgba(0,0,0,.2);
  169. transition: all .2s ease-in-out;
  170. .contextmenu-item {
  171. display: block;
  172. padding: 5px 20px;
  173. line-height: 1.5;
  174. color: #555;
  175. cursor: pointer;
  176. transition: all .2s ease-in-out;
  177. user-select: none;
  178. &:hover {
  179. color: #333;
  180. background: $bgHover;
  181. }
  182. &:active {
  183. background: $bgActive;
  184. }
  185. &[disabled] {
  186. color: #aaa;
  187. background: none;
  188. pointer-events: none;
  189. cursor: default;
  190. }
  191. }
  192. }
  193. }
  194. .is-tab-fullscreen .router-tab-container {
  195. position: fixed;
  196. top: 0;
  197. right: 0;
  198. bottom: 0;
  199. left: 0;
  200. z-index: 990;
  201. }