作者 lihongjuan

1

  1 +<template>
  2 + <view class="content">
  3 +
  4 + <view class="teacherfooter">
  5 + <view class="teacherfootitem" @click="gotab(item,index)" v-for="(item,index) in list" :key="index">
  6 + <view class="teacherfootitemtop shou">
  7 + <image :src="currentTabIndex == index?item.selectedIconPath:item.iconPath"></image>
  8 + </view>
  9 + <view class="teacherfootname " :class="currentTabIndex == index?'activename':''" >{{item.text}}</view>
  10 +
  11 + </view>
  12 + </view>
  13 +
  14 + </view>
  15 +
  16 +</template>
  17 +
  18 +<script>
  19 +
  20 + export default {
  21 + data() {
  22 + return {
  23 + list: [{
  24 + "pagePath": "/pages/homepage/homepage",
  25 + "iconPath": "../../static/index.png",
  26 + "selectedIconPath": "../../static/indexactive.png",
  27 + "text": "首页",
  28 +
  29 + }, {
  30 + "pagePath": "/pages/nearshop/nearshop",
  31 + "iconPath": "../../static/nearshop.png",
  32 + "selectedIconPath": "../../static/nearshopactive.png",
  33 + "text": "附近店铺"
  34 + },
  35 + {
  36 + "pagePath": "/pages/luntan/luntan",
  37 + "iconPath": "../../static/luntan.png",
  38 + "selectedIconPath": "../../static/luntanactive.png",
  39 + "text": "中面论坛"
  40 + },
  41 + {
  42 + "pagePath": "/pages/usercenter/my",
  43 + "iconPath": "../../static/user.png",
  44 + "selectedIconPath": "../../static/useractive.png",
  45 + "text": "个人中心"
  46 + }
  47 +
  48 + ],
  49 + currentTabIndex: this.current
  50 + }
  51 + },
  52 + props: {
  53 + current: {
  54 + type: [Number, String],
  55 + default: 0
  56 + },
  57 + backgroundColor: {
  58 + type: String,
  59 + default: '#fbfbfb'
  60 + },
  61 + color: {
  62 + type: String,
  63 + default: '#999'
  64 + },
  65 + tintColor: {
  66 + type: String,
  67 + default: '#42b983'
  68 + }
  69 + },
  70 + onLoad() {
  71 +
  72 +
  73 + },
  74 + methods: {
  75 + gotab(item,index) {
  76 + this.currentTabIndex = index;
  77 + console.log(item.pagePath);
  78 + let url=item.pagePath
  79 + console.log(url)
  80 +
  81 + uni.switchTab({url})
  82 + }
  83 +
  84 + }
  85 +
  86 + }
  87 +</script>
  88 +
  89 +<style>
  90 +
  91 +</style>