App.vue 4.7 KB

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