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>
相关推荐
leobertlan3 小时前
2025年终总结
前端·后端·程序员
子兮曰4 小时前
OpenClaw架构揭秘:178k stars的个人AI助手如何用Gateway模式统一控制12+通讯频道
前端·javascript·github
Howrun7774 小时前
VSCode烦人的远程交互UI讲解
ide·vue.js·vscode
百锦再4 小时前
Reactive编程入门:Project Reactor 深度指南
前端·javascript·python·react.js·django·前端框架·reactjs
莲华君4 小时前
React快速上手:从零到项目实战
前端·reactjs教程
百锦再4 小时前
React编程高级主题:测试代码
android·前端·javascript·react.js·前端框架·reactjs
易安说AI5 小时前
Ralph Loop 让Claude无止尽干活的牛马...
前端·后端
颜酱6 小时前
图结构完全解析:从基础概念到遍历实现
javascript·后端·算法
失忆爆表症6 小时前
05_UI 组件库集成指南:Shadcn/ui + Tailwind CSS v4
前端·css·ui
小迷糊的学习记录6 小时前
Vuex 与 pinia
前端·javascript·vue.js