<!--
 tabbar
-->
<template>
  <div>
    <web-view :src="pageUrl" @error="handleError"></web-view>
  </div>
</template>

<script>
import { getUrlofLink } from "../../utils/mayi.js";
export default {
  data() {
    return {
      link: process.env.BASE_URL,
      page: "/",
      params: "?mixid=" + this.$store.state.mixid,
      index:1
    };
  },
  computed: {
    pageUrl() {
      return this.link + this.page + this.params;
    },
  },
  onLoad(options) {
    // tabbar 跳转
    if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
      this.page = getUrlofLink(
        this.mpApp.globalData.footerVal.componentData.list[this.index].link
      );
      this.mpApp.globalData.tabBarPageLink = "";
    }
  },
  onShow(){
    console.log('show')
    if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
      this.page = getUrlofLink(
        this.mpApp.globalData.footerVal.componentData.list[this.index].link
      );
      this.mpApp.globalData.tabBarPageLink = "";
    }
    // if (typeof this.getTabBar === 'function' &&
    //   this.getTabBar()) {
    //   this.getTabBar().setData({
    //     selected: 0
    //   })
    // }
  },
  methods: {
    handleError(data) {
      wx.showLoading({
        title: "网页加载失败 请右上角刷新",
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>