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>
相关推荐
用户新2 小时前
V8引擎 精品漫游指南--Ignition篇(下 一) 动态执行前的事情
前端·javascript
@PHARAOH4 小时前
WHAT - GitLens vs Fork
前端
yqcoder4 小时前
前端性能优化:如何减少重绘与重排?
前端·性能优化
洋子5 小时前
Yank Note 系列 13 - 让 AI Agent 进入笔记工作流
前端·人工智能
wenzhangli77 小时前
Ooder A2UI 核心架构深度解析:WEB 拦截层的设计与实现
前端·架构
前端百草阁7 小时前
【前端性能优化全链路指南】从开发编写到构建运行的多维度实践
前端·性能优化
神探小白牙7 小时前
eCharts 多系列柱状图增加背景图
javascript·ecmascript·echarts
女生也可以敲代码8 小时前
AI时代下的50道前端开发面试题:从基础到大模型应用
前端·面试
ZhengEnCi8 小时前
M5-markconv自定义CSS样式指南 📝
前端·css·python
IT_陈寒8 小时前
SpringBoot自动配置的坑差点让我加班到天亮
前端·人工智能·后端