zoukankan      html  css  js  c++  java
  • Vue遇到的问题

    1.下载文件时window.location.href=url只能使用get请求,get请求时如果参数过长,浏览器会报400错误,这时需要使用post请求。可以用模拟提交表单的方式实现下载文件:

          exportOk(){
             let demoUrl = gl.serverURL + "/common/tool/export";
             let temp_form = document.createElement("form");
             // 设置form属性
            temp_form.action = demoUrl;
            temp_form.target = "_self";
            temp_form.method = "post";
            temp_form.style.display = "none";
            //使用input参数会截断,应该是input对字符有长度限制
            let opt = document.createElement("textarea");
            opt.name = "sql";
            opt.value = sql;
            temp_form .appendChild(opt);
            document.body.appendChild(temp_form);
            // 提交表单
            temp_form .submit();
          }
  • 相关阅读:
    SpringBoot定制修改Servlet容器
    springboot配置i18n
    idea properties编码问题
    多线程分页查询
    浏览器 私有属性&内核
    css添加样式的四种方式
    html、css、js注释
    JS中的 变量提升
    ECMAScript
    NOSCRIPT标签的用处
  • 原文地址:https://www.cnblogs.com/srp750115867/p/10821199.html
Copyright © 2011-2022 走看看