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>
相关推荐
.生产的驴1 分钟前
泛微E10二开 前端Ecode拦截器
前端
亿元程序员7 分钟前
PinK(Cocos4.0?)生成飞机大战,抢先体验全流程!
前端
晓得迷路了10 分钟前
栗子前端技术周刊第 111 期 - Next.js 16.1、pnpm 10.26、Bun 1.3.5...
前端·javascript·bun
CodeSheep19 分钟前
中国四大软件外包公司
前端·后端·程序员
七月shi人20 分钟前
使用Node版本管理包n,在MAC电脑权限问题
前端·macos
shangxianjiao21 分钟前
vue前端项目介绍项目结构
前端·javascript·vue.js
Mike_jia28 分钟前
4ga Boards:重新定义高效协作的实时看板工具实战指南
前端
袖手蹲31 分钟前
Arduino UNO Q使用Streamlit构建WebUI:零前端经验打造交互式硬件控制
前端
大布布将军35 分钟前
⚡️编排的艺术:BFF 的核心职能——数据聚合与 HTTP 请求
前端·网络·网络协议·程序人生·http·node.js·改行学it
冒冒菜菜40 分钟前
RSAR的前端可视化界面
前端