App.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div id="app">
  3. <!-- <header class="bar bar-nav d-flex justify-content-between align-items-center p-2">-->
  4. <!-- <el-button type="text" icon="el-icon-arrow-left" v-on:click="goBack"-->
  5. <!-- v-if="$route.meta.showBackLeftBtn"></el-button>-->
  6. <!--&lt;!&ndash; <h4 class="title">{{title}}</h4>&ndash;&gt;-->
  7. <!-- <el-button type="text"><span v-if="$route.meta.showBarRightBtn">编辑</span></el-button>-->
  8. <!-- </header>-->
  9. <keep-alive>
  10. <router-view class="app-body" v-if="$route.meta.keepAlive"/>
  11. </keep-alive>
  12. <router-view class="app-body" v-if="!$route.meta.keepAlive"/>
  13. <div class="tab-nav nav-bar" v-if="$route.meta.showTab">
  14. <a href="javascript:;" v-for="(i,index) in data.tabs" :key="index" :class="{active:index == data.thatnum}" @click="addClassName(index)">
  15. <router-link :to="i.url">
  16. <img v-if="data.thatnum!=index" :src="i.img" class="first weui-tabbar__icon">
  17. <img v-if="data.thatnum==index" :src="i.active" class="last first weui-tabbar__icon">
  18. </router-link>
  19. </a>
  20. </div>
  21. </div>
  22. </template>
  23. <script lang="ts" >
  24. import {Component,Vue} from "vue-property-decorator";
  25. import router from "@/router";
  26. import Utils from './extend/Utils';
  27. @Component({})
  28. export default class App extends Vue {
  29. public data:any= {
  30. thatnum: -1,
  31. tabs:[
  32. {url:'/index',img:require('./assets/image/label_01.png'),active:require('./assets/image/label-2_01.png')},
  33. {url:'/other',img:require('./assets/image/label_02.png'),active:require('./assets/image/label-2_02.png')},
  34. {url:'/user',img:require('./assets/image/label_03.png'),active:require('./assets/image/label-2_03.png')}
  35. ]
  36. }
  37. addClassName(index) {
  38. this.data.thatnum = index;
  39. }
  40. public get title() {
  41. return this.$route.meta.title;
  42. }
  43. public goBack() {
  44. router.back();
  45. }
  46. }
  47. </script>
  48. <style lang="scss">
  49. @import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
  50. @import '@/assets/scss/common.scss';
  51. #app {
  52. position: relative;
  53. min-height: 100%;
  54. background: white;
  55. }
  56. #app > div:first-child {
  57. font-size: 1.2rem;
  58. }
  59. .nav-ul{
  60. display: flex;
  61. width: 100%;
  62. }
  63. .tab-nav {
  64. position: fixed;
  65. display: flex;
  66. justify-content: space-between;
  67. bottom: 0;
  68. left: 0;
  69. right: 0;
  70. border-bottom: 0;
  71. border-top: 1px solid #f0f0f0;
  72. background: #fff;
  73. z-index: 999;
  74. img{
  75. width: 100%;
  76. }
  77. }
  78. .app-body {
  79. /*margin-top: 45px;*/
  80. /*margin-bottom: 5rem;*/
  81. overflow: hidden;
  82. }
  83. .bar-nav .title {
  84. position: absolute;
  85. left: 0;
  86. right: 0;
  87. text-align: center;
  88. }
  89. body .el-message-box {
  90. width: 300px;
  91. }
  92. </style>