<template>
  <div>
    <div class="loading-box">
      <van-loading size="24px" color="#0094ff">加载中....</van-loading>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fromPage: "",
    };
  },
  created() {
    let _this = this;
    console.log(_this.fromPage,"created");
  },
  mounted() {
    let _this = this;
    console.log(_this.fromPage,"mounted");
    if ("/home" === _this.fromPage) { 
      window.location.href = "https://www.baidu.com"; // 跳转对应地址
    } else { 
      _this.$router.push({name: "HomeIndex"});
    }
  },
  beforeRouteEnter(to, from, next) {
    console.log(from, 'beforeRouteEnter');
    next(vm => {
      // vm相当于上面的this
      vm.fromPage = from.path;
    });
  },
  methods: {}
};
</script>

<style lang="less" scoped></style>
Logo

前往低代码交流专区

更多推荐