flowstocktrading
2022-11-03 2f72cf1a3a30b665619e7fcaa2657e225598554e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
  <div id="app" :class="`${$state.theme === 'red' ? 'red-theme' : 'black-theme'}`">
    <div :class="`header-box`" v-if="hasHeader && title !== '新登录'">
      <mt-header :title="title">
        <mt-button icon="back" slot="left" @click="$router.go(-1)"></mt-button>
        <template v-if="iconRight == 'search'">
          <img slot="right" class="search-right" src="./assets/ico/fangdajing.png" alt />
        </template>
        <template v-else>
          <mt-button icon="more" slot="right"></mt-button>
        </template>
      </mt-header>
    </div>
    <div class="body-box">
      <transition
      :name="transitionName"
      >
        <router-view></router-view>
      </transition>
    </div>
    <foot></foot>
  </div>
</template>
 
<script>
  import foot from "@/components/foot.vue";
export default {
  components: {
    foot,
    },
  name: "App",
  created() {
    let title = this.$route.meta.title || "首页";
    this.title = title;
 
    if (this.$route.meta.hasHeader) {
      this.hasHeader = true;
    } else {
      this.hasHeader = false;
    }
    if (this.$route.meta.iconRight) {
      this.iconRight = this.$route.meta.iconRight;
    } else {
      this.iconRight = "default";
    }
    // this.$store.state.className = window.localStorage.getItem('styleName')?window.localStorage.getItem('styleName'):'red'
  },
  watch: {
    $route(to, from) {
      let title = to.meta.title || "首页";
      this.title = title;
      if (to.meta.iconRight) {
        this.iconRight = to.meta.iconRight;
      } else {
        this.iconRight = "default";
      }
      if (to.meta.hasHeader) {
        this.hasHeader = true;
      } else {
        this.hasHeader = false;
      }
      if (to.meta.index > from.meta.index) {
        console.log("slide-left");
        //设置动画名称
        this.transitionName = "slide-left";
      } else {
        console.log("slide-right");
        this.transitionName = "slide-right";
      }
    }
  },
  data() {
    return {
      title: "首页",
      hasHeader: false,
      iconRight: "default",
      transitionName: ''
    };
  }
};
</script>
 
<style lang="less" scoped>
#app {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: "rubik";
  .header-box {
    width: 100%;
    height: 1rem;
    /deep/.mint-header {
      height: 100%;
      background-color: #16171d;
      // background-color: rgba(20, 45, 55, 0.3);
      .is-left {
        .mintui {
          font-size: 20px;
        }
      }
      .mint-header-title {
        font-size: 0.36rem;
        color: rgba(255, 255, 255, 1);
      }
    }
    button {
      outline: none;
    }
  }
  .body-box {
    width: 100%;
    height: calc(100% - 1rem);
    box-sizing: border-box;
    overflow-y: auto;
  }
  &.red-theme {
    background: #e9e9e9;
    /deep/.mint-header {
      background: none;
      .mint-header-title {
        font-size: 0.36rem;
        color: #212121;
      }
      .mintui {
        color: #212121;
      }
    }
  }
  &.black-theme {
    // background: #16171d;
    // background: rgb(14, 14, 15);
    background: rgb(33, 33, 43);
  }
}
.search-right {
  width: 0.3rem;
  height: 0.3rem;
}
.mint-search-list {
  position: relative !important;
}
</style>