home.uvue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <cl-page>
  3. <cl-topbar fixed :show-back="false" safe-area-top :height="isMp() ? null : 100">
  4. <view
  5. class="flex flex-row items-center p-3 flex-1 w-full"
  6. :class="{
  7. 'pt-0': isMp()
  8. }"
  9. >
  10. <view class="bg-primary-500 rounded-lg p-[12rpx]">
  11. <cl-image
  12. src="/static/logo.png"
  13. :width="32"
  14. :height="32"
  15. :show-loading="false"
  16. ></cl-image>
  17. </view>
  18. <text class="text-2xl text-primary-500 dark:!text-white mr-auto ml-2 flex-1"
  19. >cool-unix</text
  20. >
  21. <view
  22. class="bg-primary-500 h-8 w-8 rounded-full flex flex-row items-center justify-center"
  23. :class="{
  24. 'mr-24': isMp()
  25. }"
  26. @tap="setLocale"
  27. >
  28. <cl-icon name="translate" color="white"></cl-icon>
  29. </view>
  30. </view>
  31. </cl-topbar>
  32. <view class="p-3">
  33. <view class="group" v-for="item in data" :key="item.label">
  34. <text class="title dark:!text-surface-50">{{ item.label }}</text>
  35. <view class="list">
  36. <cl-row :gutter="10">
  37. <cl-col :span="6" v-for="child in item.children" :key="child.label">
  38. <view
  39. class="item dark:!bg-surface-800"
  40. hover-class="opacity-80"
  41. :hover-stay-time="50"
  42. @tap="toPath(child.path!)"
  43. >
  44. <cl-icon :name="child.icon" :size="36"></cl-icon>
  45. <cl-text
  46. :pt="{
  47. className: 'mt-1 !text-xs text-center'
  48. }"
  49. >{{ child.label }}</cl-text
  50. >
  51. </view>
  52. </cl-col>
  53. </cl-row>
  54. </view>
  55. </view>
  56. </view>
  57. <tabbar></tabbar>
  58. <locale-set :ref="refs.set('localeSet')"></locale-set>
  59. </cl-page>
  60. </template>
  61. <script lang="ts" setup>
  62. import { isMp, router, useRefs } from "@/cool";
  63. import LocaleSet from "@/components/locale-set.uvue";
  64. import { t } from "@/locale";
  65. import { computed } from "vue";
  66. import Tabbar from "@/components/tabbar.uvue";
  67. import { useUi } from "@/uni_modules/cool-ui";
  68. const ui = useUi();
  69. const refs = useRefs();
  70. type Item = {
  71. label: string;
  72. icon?: string;
  73. path?: string;
  74. children?: Item[];
  75. };
  76. const data = computed<Item[]>(() => {
  77. return [
  78. {
  79. label: t("基础组件"),
  80. children: [
  81. {
  82. label: t("文本"),
  83. icon: "text",
  84. path: "/pages/demo/basic/text"
  85. },
  86. {
  87. label: t("按钮"),
  88. icon: "mouse-line",
  89. path: "/pages/demo/basic/button"
  90. },
  91. {
  92. label: t("图片"),
  93. icon: "image-line",
  94. path: "/pages/demo/basic/image"
  95. },
  96. {
  97. label: t("图标"),
  98. icon: "puzzle-2-line",
  99. path: "/pages/demo/basic/icon"
  100. },
  101. {
  102. label: t("标签"),
  103. icon: "price-tag-3-line",
  104. path: "/pages/demo/basic/tag"
  105. }
  106. ]
  107. },
  108. {
  109. label: t("表单组件"),
  110. children: [
  111. {
  112. label: t("输入框"),
  113. icon: "input-field",
  114. path: "/pages/demo/form/input"
  115. },
  116. {
  117. label: t("文本域"),
  118. icon: "text-block",
  119. path: "/pages/demo/form/textarea"
  120. },
  121. {
  122. label: t("计数器"),
  123. icon: "increase-decrease-line",
  124. path: "/pages/demo/form/input-number"
  125. },
  126. {
  127. label: t("口令输入"),
  128. icon: "t-box-line",
  129. path: "/pages/demo/form/input-otp"
  130. },
  131. {
  132. label: t("键盘"),
  133. icon: "keyboard-box-line",
  134. path: "/pages/demo/form/keyboard"
  135. },
  136. {
  137. label: t("单选框"),
  138. icon: "radio-button-line",
  139. path: "/pages/demo/form/radio"
  140. },
  141. {
  142. label: t("多选框"),
  143. icon: "checkbox-line",
  144. path: "/pages/demo/form/checkbox"
  145. },
  146. {
  147. label: t("开关"),
  148. icon: "toggle-line",
  149. path: "/pages/demo/form/switch"
  150. },
  151. {
  152. label: t("评分"),
  153. icon: "star-line",
  154. path: "/pages/demo/form/rate"
  155. },
  156. {
  157. label: t("滑块"),
  158. icon: "equalizer-2-line",
  159. path: "/pages/demo/form/slider"
  160. },
  161. {
  162. label: t("选择器"),
  163. icon: "dropdown-list",
  164. path: "/pages/demo/form/select"
  165. },
  166. {
  167. label: t("日期选择器"),
  168. icon: "calendar-line",
  169. path: "/pages/demo/form/select-date"
  170. },
  171. {
  172. label: t("时间选择器"),
  173. icon: "time-line",
  174. path: "/pages/demo/form/select-time"
  175. },
  176. {
  177. label: t("级联选择器"),
  178. icon: "stacked-view",
  179. path: "/pages/demo/form/cascader"
  180. },
  181. {
  182. label: t("文件上传"),
  183. icon: "file-upload-line",
  184. path: "/pages/demo/form/upload"
  185. }
  186. ]
  187. },
  188. {
  189. label: t("布局组件"),
  190. children: [
  191. {
  192. label: t("弹性布局"),
  193. icon: "layout-2-line",
  194. path: "/pages/demo/layout/flex"
  195. },
  196. {
  197. label: t("标签页"),
  198. icon: "function-add-line",
  199. path: "/pages/demo/layout/tabs"
  200. },
  201. {
  202. label: t("折叠面板"),
  203. icon: "collapse-vertical-line",
  204. path: "/pages/demo/layout/collapse"
  205. },
  206. {
  207. label: t("吸顶"),
  208. icon: "align-top",
  209. path: "/pages/demo/layout/sticky"
  210. },
  211. {
  212. label: t("导航栏"),
  213. icon: "layout-top-line",
  214. path: "/pages/demo/layout/topbar"
  215. },
  216. {
  217. label: t("底部视图"),
  218. icon: "layout-bottom-line",
  219. path: "/pages/demo/layout/footer"
  220. },
  221. {
  222. label: t("悬浮视图"),
  223. icon: "picture-in-picture-line",
  224. path: "/pages/demo/layout/float-view"
  225. }
  226. ]
  227. },
  228. {
  229. label: t("数据展示"),
  230. children: [
  231. {
  232. label: t("头像"),
  233. icon: "account-circle-line",
  234. path: "/pages/demo/data/avatar"
  235. },
  236. {
  237. label: t("列表"),
  238. icon: "list-check",
  239. path: "/pages/demo/data/list"
  240. },
  241. {
  242. label: t("列表视图"),
  243. icon: "list-view",
  244. path: "/pages/demo/data/list-view"
  245. },
  246. {
  247. label: t("瀑布流"),
  248. icon: "layout-column-line",
  249. path: "/pages/demo/data/waterfall"
  250. },
  251. {
  252. label: t("轮播图"),
  253. icon: "carousel-view",
  254. path: "/pages/demo/data/banner"
  255. },
  256. {
  257. label: t("分页"),
  258. icon: "page-separator",
  259. path: "/pages/demo/data/pagination"
  260. },
  261. {
  262. label: t("时间轴"),
  263. icon: "timeline-view",
  264. path: "/pages/demo/data/timeline"
  265. },
  266. {
  267. label: t("拖拽"),
  268. icon: "drag-move-line",
  269. path: "/pages/demo/data/draggable"
  270. }
  271. ]
  272. },
  273. {
  274. label: t("状态组件"),
  275. children: [
  276. {
  277. label: t("角标"),
  278. icon: "notification-badge-line",
  279. path: "/pages/demo/status/badge"
  280. },
  281. {
  282. label: t("通知栏"),
  283. icon: "error-warning-line",
  284. path: "/pages/demo/status/noticebar"
  285. },
  286. {
  287. label: t("倒计时"),
  288. icon: "timer-line",
  289. path: "/pages/demo/status/countdown"
  290. },
  291. {
  292. label: t("数字滚动"),
  293. icon: "arrow-up-box-line",
  294. path: "/pages/demo/status/rolling-number"
  295. },
  296. {
  297. label: t("进度条"),
  298. icon: "subtract-line",
  299. path: "/pages/demo/status/progress"
  300. },
  301. {
  302. label: t("圆形进度条"),
  303. icon: "circle-line",
  304. path: "/pages/demo/status/progress-circle"
  305. },
  306. {
  307. label: t("骨架图"),
  308. icon: "shadow-line",
  309. path: "/pages/demo/status/skeleton"
  310. },
  311. {
  312. label: t("加载更多"),
  313. icon: "loader-4-line",
  314. path: "/pages/demo/status/loadmore"
  315. }
  316. ]
  317. },
  318. {
  319. label: t("反馈组件"),
  320. children: [
  321. {
  322. label: t("操作菜单"),
  323. icon: "menu-line",
  324. path: "/pages/demo/feedback/action-sheet"
  325. },
  326. {
  327. label: t("弹窗"),
  328. icon: "chat-4-line",
  329. path: "/pages/demo/feedback/popup"
  330. },
  331. {
  332. label: t("确认框"),
  333. icon: "chat-check-line",
  334. path: "/pages/demo/feedback/confirm"
  335. },
  336. {
  337. label: t("提示框"),
  338. icon: "message-2-line",
  339. path: "/pages/demo/feedback/toast"
  340. }
  341. ]
  342. },
  343. {
  344. label: "其他",
  345. children: [
  346. {
  347. label: "QRCode",
  348. icon: "qr-code-line",
  349. path: "/pages/demo/other/qrcode"
  350. },
  351. {
  352. label: "DayUts",
  353. icon: "timer-2-line",
  354. path: "/pages/demo/other/day-uts"
  355. },
  356. {
  357. label: "Vibrate",
  358. icon: "volume-vibrate-line",
  359. path: "/pages/demo/other/vibrate"
  360. }
  361. ]
  362. }
  363. ];
  364. });
  365. function toPath(path: string) {
  366. router.to(path);
  367. }
  368. function setLocale() {
  369. refs.open("localeSet");
  370. }
  371. </script>
  372. <style lang="scss" scoped>
  373. .group {
  374. @apply mb-10;
  375. .title {
  376. @apply text-sm mb-2 ml-1 text-surface-500;
  377. }
  378. .list {
  379. .item {
  380. @apply flex flex-col items-center;
  381. @apply rounded-xl bg-white p-2;
  382. height: 140rpx;
  383. margin-bottom: 10rpx;
  384. padding-top: 36rpx;
  385. }
  386. }
  387. }
  388. </style>