App.vue 4.7 KB

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