template.vue 1.8 KB

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