vue页面默认打开就弹出提示

html 复制代码
<template>
  <div class="divBox" style="background: #F0F2F5; padding: 0 10px 10px;">
    <base-info ref="baseInfo" class="mb15" />
    <to-day class="mb15" />

    <user-data class="mb15" />
    <user-from />
  </div>
</template>
javascript 复制代码
<script>
export default {
  name: "Dashboard",
  components: { baseInfo, toDay, myRanking, merchantRate, userData, userFrom },
  data() {
    return {
      merTitle: "商品销量排行",
      visitTitle: "商户访客量排行",
      currentRole: "adminDashboard",
      grid: {
        xl: 8,
        lg: 8,
        md: 12,
        sm: 12,
        xs: 24
      },
      merchantStock: [],
      merchantVisit: []
    };
  },
  computed: {
    ...mapGetters(["roles"])
  },
  mounted() {
    this.getAuth();
    this.getList("lately30");
    this.getVisit("lately30");
    if(!Cookies.get("auth")) {
      checkAuthApi()
        .then(res => {
          if(res.message !== "success") {
            return this.$notify.warning({
              title: "提醒11111",
              duration: 0,
              dangerouslyUseHTMLString: true,
              message: res.message,
              render: h => {
                return h("div", [
                  h(
                    "a",
                    {
                      attrs: {
                        href:
                          "http://a.b.com",
                        target: "_blank"
                      }
                    },
                    res.message
                  )
                ]);
              },
              onClose() {
                Cookies.set("auth", true);
              }
            });
          }
        })
        .catch(res => { });
    } else {
    }
  },
  methods: {
    getAuth() {
      authTypeApi()
        .then(res => {
          const data = res.data || {};
          if(data.auth_code && data.auth) {
            this.authCode = data.auth_code;
            this.auth = true;
          }
        })
    },
    // 商品销量
    getList(val) {
      merchantStockApi({ date: val })
        .then(res => {
          if(res.status === 200) {
            this.merchantStock = res.data.list;
          }
        })
        .catch(res => {
          this.$message.error(res.message);
        });
    },
    // 商户访客量
    getVisit(val) {
      merchantVisitApi({ date: val })
        .then(res => {
          if(res.status === 200) {
            this.merchantVisit = res.data.list;
          }
        })
        .catch(res => {
          this.$message.error(res.message);
        });
    },
   
  }
};
</script>
相关推荐
Liu.7741 小时前
uniappx鸿蒙适配
前端
叫我阿柒啊2 小时前
Java全栈开发面试实战:从基础到微服务架构
java·vue.js·spring boot·redis·git·full stack·interview
山有木兮木有枝_2 小时前
从代码到创作:探索AI图片生成的神奇世界
前端·coze
ZXT2 小时前
js基础重点复习
javascript
言兴2 小时前
秋招面试---性能优化(良子大胃袋)
前端·javascript·面试
WebInfra4 小时前
Rspack 1.5 发布:十大新特性速览
前端·javascript·github
雾恋4 小时前
我用 trae 写了一个菜谱小程序(灶搭子)
前端·javascript·uni-app
烛阴5 小时前
TypeScript 中的 `&` 运算符:从入门、踩坑到最佳实践
前端·javascript·typescript
Java 码农6 小时前
nodejs koa留言板案例开发
前端·javascript·npm·node.js
ZhuAiQuan6 小时前
[electron]开发环境驱动识别失败
前端·javascript·electron