demo.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="wrap">
  3. <page-nav :desc="desc" :title="title"></page-nav>
  4. <view class="list-wrap">
  5. <u-cell-group title-bg-color="rgb(243, 244, 246)" :title="getGroupTitle(item)" v-for="(item, index) in list"
  6. :key="index">
  7. <u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item1.path)" :title="getFieldTitle(item1)"
  8. v-for="(item1, index1) in item.list" :key="index1">
  9. <image slot="icon" class="u-cell-icon" :src="getIcon(item1.icon)" mode="widthFix"></image>
  10. </u-cell-item>
  11. </u-cell-group>
  12. </view>
  13. <u-gap height="70"></u-gap>
  14. </view>
  15. </template>
  16. <script>
  17. import pageNav from '@/components/page-nav/page-nav.vue';
  18. import list from "./demo.config.js";
  19. export default {
  20. components: {
  21. pageNav
  22. },
  23. data() {
  24. return {
  25. list: list,
  26. title: '基础功能示例合集',
  27. desc: '众多示例覆盖开发过程的各个需求,正在不断完善中。可让您快速集成,开箱即用。'
  28. }
  29. },
  30. computed: {
  31. getIcon() {
  32. return path => {
  33. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  34. }
  35. },
  36. },
  37. onShow() {
  38. uni.setNavigationBarTitle({
  39. title: "233"
  40. });
  41. },
  42. created() {
  43. },
  44. methods: {
  45. openPage(path) {
  46. this.$u.route({
  47. url: path
  48. })
  49. },
  50. getGroupTitle(item) {
  51. return item.groupName
  52. },
  53. getFieldTitle(item) {
  54. return item.title
  55. }
  56. }
  57. }
  58. </script>
  59. <style>
  60. /* page {
  61. background-color: rgb(240, 242, 244);
  62. } */
  63. </style>
  64. <style lang="scss" scoped>
  65. .u-cell-icon {
  66. width: 36rpx;
  67. height: 36rpx;
  68. margin-right: 8rpx;
  69. }
  70. </style>