home.uvue 8.4 KB

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