template.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="wrap">
  3. <page-nav :desc="desc" title="nav.template"></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" :key="index">
  6. <u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item1.path)" :title="getFieldTitle(item1)"
  7. v-for="(item1, index1) in item.list" :key="index1">
  8. <image slot="icon" class="u-cell-icon" :src="getIcon(item1.icon)" mode="widthFix"></image>
  9. </u-cell-item>
  10. </u-cell-group>
  11. </view>
  12. <u-gap height="70"></u-gap>
  13. <!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
  14. </view>
  15. </template>
  16. <script>
  17. import list from "./template.config.js";
  18. export default {
  19. data() {
  20. return {
  21. list: list,
  22. // desc: '收集众多的常用页面和布局,减少开发者的重复工作,让你专注逻辑,事半功倍'
  23. }
  24. },
  25. computed: {
  26. getIcon() {
  27. return path => {
  28. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  29. }
  30. },
  31. desc() {
  32. return this.$t('template.desc');
  33. }
  34. },
  35. onShow() {
  36. uni.setNavigationBarTitle({
  37. title: this.$t('nav.template')
  38. });
  39. },
  40. methods: {
  41. openPage(path) {
  42. this.$u.route({
  43. url: path.indexOf('/page') == 0 ? path : '/pages/template/' + path + '/index'
  44. })
  45. },
  46. getGroupTitle(item) {
  47. return this.$i18n.locale == 'zh' ? item.groupName : item.groupName_en
  48. },
  49. getFieldTitle(item) {
  50. return this.$i18n.locale == 'zh' ? item.title : item.title_en
  51. }
  52. }
  53. }
  54. </script>
  55. <style>
  56. /* page {
  57. background-color: rgb(240, 242, 244);
  58. } */
  59. </style>
  60. <style lang="scss" scoped>
  61. .u-cell-icon {
  62. width: 36rpx;
  63. height: 36rpx;
  64. margin-right: 8rpx;
  65. }
  66. </style>