zoukankan      html  css  js  c++  java
  • 前端调用路由导出数据方法记录

    1.登录接口调用之后赋值token
      this.$cookie.set('token', data.token)
     
     2.this.$http.BASE_URL :配置的全局基础路由
    封装ajax的页面:
    // 跨域请求,允许保存cookie
    axios.defaults.withCredentials = true
    axios.defaults.headers = {'Content-Type': 'application/json; charset=utf-8'}
    // 非生产环境 && 开启代理, 接口前缀统一使用空''前缀做代理拦截!
    const BASE_URL = process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/api' : window.SITE_CONFIG.baseUrl
    // 对面暴露的基础请求路径
    axios.BASE_URL = BASE_URL
     
    3.导出的API:/api/ec/amo/sys/scheduling/anchor/export
    方法:
     <el-button type="primary" @click="exportFun()">导出数据</el-button>
    // 导出数据
          exportFun() {
            let exporthref = this.$http.BASE_URL + `/api/ec/amo/sys/scheduling/anchor/export?order=${this.searchForm.order}&liveStatus=${this.searchForm.liveStatus}&brandId=${this.searchForm.brandId}&token=${this.$cookie.get('token')}`
            window.open(exporthref)
          },
  • 相关阅读:
    读《暗时间》
    文献笔记8
    文献笔记4
    文献笔记2
    文献笔记5
    文献笔记6
    文献笔记1
    文献笔记3
    读《暗时间》2
    文献笔记7
  • 原文地址:https://www.cnblogs.com/wssdx/p/12980410.html
Copyright © 2011-2022 走看看