123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <div class="NavBar" id="NavBar">
- <van-tabbar v-model="tabbarTempValue" @change="onChange" >
- <van-tabbar-item icon="wap-home">首页</van-tabbar-item>
- <van-tabbar-item icon="comment">工作台</van-tabbar-item>
- <van-tabbar-item icon="manager">个人中心</van-tabbar-item>
- </van-tabbar>
- <router-view></router-view>
-
- {{item.title}}
- </div>
- </template>
- <script>
- import Vue from 'vue';
- import VueRouter from 'vue-router';
- export default {
- props: {
- active: Number
- },
- name:'NavBar',
- data() {
- return {
- imgUrl:'',
- tabbarTempValue: this.active,
- tabbars: [
- {
- name: "/",
- title: "首页",
- normal: "http://test2.h-etrip.com/app/assets/img/TabsHome.png",
- active: "../../assets/img/icon_tab_hp_selected.png"
- },
- {
- name: "/workbench",
- title: "工作台",
- normal: "http://test2.h-etrip.com/app/assets/img/TabsTravel.png",
- active: "http://test2.h-etrip.com/app/assets/img/TabsTravelFocus.png"
- },
- {
- name: "/user",
- title: "我的",
- normal: "http://test2.h-etrip.com/app/assets/img/TabsFace.png",
- active: "http://test2.h-etrip.com/app/assets/img/TabsFaceFocus.png"
- }
- ]
- }
- },
- created() {
-
- console.log(this.$route);
-
-
-
- },
- methods:{
- async NavInit() {
- if(localStorage.getItem('token')){
- const res = await this.$http.get('/user/' + localStorage.getItem('id'))
- this.imgUrl = res.data[0].user_img
- }
- },
-
- onChange(index){
- console.log(index)
- this.tabbarTempValue = 0
-
-
- if(index == 0){
- this.$router.push("/home");
- }else if(index == 1){
- this.$router.push("/workbench");
- }else{
- this.$router.push("/user");
- }
-
- }
- },
- mounted() {
-
- }
- }
- </script>
- <style scoped lang="less">
- .NavBar{
- }
- </style>
|