App.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <script>
  2. import {
  3. init
  4. } from "@/common";
  5. export default {
  6. onLaunch(options) {
  7. init(options);
  8. // #ifndef MP-TOUTIAO
  9. uni.hideTabBar({});
  10. // #endif
  11. }
  12. };
  13. </script>
  14. <style lang="scss">
  15. /*每个页面公共css */
  16. @import "uview-ui/index.scss";
  17. @import "animate.css";
  18. @import "static/iconfont/iconfont.css";
  19. @import './tuniao-ui/index.scss';
  20. @import './tuniao-ui/iconfont.css';
  21. .flxe{
  22. display: flex;
  23. }
  24. .justify-between{
  25. justify-content: space-between;
  26. }
  27. .flxe-column{
  28. flex-direction: column;
  29. }
  30. .align-center{
  31. align-items: center;
  32. }
  33. .justify-center{
  34. justify-content: center;
  35. }
  36. .flex-wrap{
  37. flex-wrap: wrap;
  38. }
  39. .u-relative,
  40. .u-rela {
  41. position: relative;
  42. }
  43. .u-absolute,
  44. .u-abso {
  45. position: absolute;
  46. }
  47. // nvue不能用标签命名样式,不能放在微信组件中,否则微信开发工具会报警告,无法使用标签名当做选择器
  48. /* #ifndef APP-NVUE */
  49. image {
  50. display: inline-block;
  51. }
  52. // 在weex,也即nvue中,所有元素默认为border-box
  53. view,
  54. text {
  55. box-sizing: border-box;
  56. }
  57. /* #endif */
  58. .u-font-xs {
  59. font-size: 22rpx;
  60. }
  61. .u-font-sm {
  62. font-size: 26rpx;
  63. }
  64. .u-font-md {
  65. font-size: 28rpx;
  66. }
  67. .u-font-lg {
  68. font-size: 30rpx;
  69. }
  70. .u-font-xl {
  71. font-size: 34rpx;
  72. }
  73. .u-flex {
  74. /* #ifndef APP-NVUE */
  75. display: flex;
  76. /* #endif */
  77. flex-direction: row;
  78. align-items: center;
  79. }
  80. .u-flex-wrap {
  81. flex-wrap: wrap;
  82. }
  83. .u-flex-nowrap {
  84. flex-wrap: nowrap;
  85. }
  86. .u-col-center {
  87. align-items: center;
  88. }
  89. .u-col-top {
  90. align-items: flex-start;
  91. }
  92. .u-col-bottom {
  93. align-items: flex-end;
  94. }
  95. .u-row-center {
  96. justify-content: center;
  97. }
  98. .u-row-left {
  99. justify-content: flex-start;
  100. }
  101. .u-row-right {
  102. justify-content: flex-end;
  103. }
  104. .u-row-between {
  105. justify-content: space-between;
  106. }
  107. .u-row-around {
  108. justify-content: space-around;
  109. }
  110. .u-text-left {
  111. text-align: left;
  112. }
  113. .u-text-center {
  114. text-align: center;
  115. }
  116. .u-text-right {
  117. text-align: right;
  118. }
  119. .u-flex-col {
  120. /* #ifndef APP-NVUE */
  121. display: flex;
  122. /* #endif */
  123. flex-direction: column;
  124. }
  125. /**
  126. * 弹性盒三段式布局
  127. */
  128. .page_box {
  129. height: 100%;
  130. width: 100%;
  131. display: flex;
  132. flex-direction: column;
  133. justify-content: space-between;
  134. overflow-x: hidden;
  135. background: $u-bg-color;
  136. }
  137. .scroll-box {
  138. flex: 1;
  139. height: 100%;
  140. position: relative;
  141. }
  142. .content_box {
  143. flex: 1;
  144. overflow-y: auto;
  145. }
  146. /**
  147. * 溢出省略号
  148. * @param {Number} 行数
  149. */
  150. @mixin ellipsis($rowCount: 1) {
  151. @if $rowCount <=1 {
  152. overflow: hidden;
  153. text-overflow: ellipsis;
  154. white-space: nowrap;
  155. } @else {
  156. min-width: 0;
  157. overflow: hidden;
  158. text-overflow: ellipsis;
  159. display: -webkit-box;
  160. -webkit-line-clamp: $rowCount;
  161. -webkit-box-orient: vertical;
  162. }
  163. }
  164. @for $i from 1 through 12 {
  165. .u-ellipsis-#{$i} {
  166. @include ellipsis($i);
  167. }
  168. }
  169. // 定义flex等分
  170. @for $i from 0 through 12 {
  171. .u-flex-#{$i} {
  172. flex: $i;
  173. }
  174. }
  175. // 定义字体(px)单位,小于20都为px单位字体
  176. @for $i from 9 to 20 {
  177. .u-font-#{$i} {
  178. font-size: $i + px;
  179. }
  180. }
  181. // 定义字体(rpx)单位,大于或等于20的都为rpx单位字体
  182. @for $i from 20 through 40 {
  183. .u-font-#{$i} {
  184. font-size: $i + rpx;
  185. }
  186. }
  187. // 定义内外边距,历遍1-100
  188. @for $i from 0 through 100 {
  189. // 只要双数和能被5除尽的数
  190. @if $i % 2 == 0 or $i % 5 == 0 {
  191. // 得出:u-margin-30或者u-m-30
  192. .u-margin-#{$i},
  193. .u-m-#{$i} {
  194. margin: $i + rpx !important;
  195. }
  196. .u-m-x-#{$i} {
  197. margin-left: $i + rpx !important;
  198. margin-right: $i + rpx !important;
  199. }
  200. .u-m-y-#{$i} {
  201. margin-top: $i + rpx !important;
  202. margin-bottom: $i + rpx !important;
  203. }
  204. // 得出:u-padding-30或者u-p-30
  205. .u-padding-#{$i},
  206. .u-p-#{$i} {
  207. padding: $i + rpx !important;
  208. }
  209. .u-p-x-#{$i} {
  210. padding-left: $i + rpx !important;
  211. padding-right: $i + rpx !important;
  212. }
  213. .u-p-y-#{$i} {
  214. padding-top: $i + rpx !important;
  215. padding-bottom: $i + rpx !important;
  216. }
  217. @each $short, $long in l left, t top, r right, b bottom {
  218. // 缩写版,结果如: u-m-l-30
  219. // 定义外边距
  220. .u-m-#{$short}-#{$i} {
  221. margin-#{$long}: $i + rpx !important;
  222. }
  223. // 定义内边距
  224. .u-p-#{$short}-#{$i} {
  225. padding-#{$long}: $i + rpx !important;
  226. }
  227. // 完整版,结果如:u-margin-left-30
  228. // 定义外边距
  229. .u-margin-#{$long}-#{$i} {
  230. margin-#{$long}: $i + rpx !important;
  231. }
  232. // 定义内边距
  233. .u-padding-#{$long}-#{$i} {
  234. padding-#{$long}: $i + rpx !important;
  235. }
  236. }
  237. }
  238. }
  239. // 重置nvue的默认关于flex的样式
  240. .u-reset-nvue {
  241. flex-direction: row;
  242. align-items: center;
  243. }
  244. </style>