axios

vue请求接口axios延时

本秂侑毒 提交于 2020-09-30 15:38:53
vue请求接口axios延时 var data = { "id": "213"}; //默认请求时间为5秒,因为请求数据量较大,增加请求链接时间到2分钟 = 120000毫秒 {timeout: 120000} this.axios.get(`test/api/exporApi?paramStr=` + JSON.stringify(data),{timeout: 120000}).then(res => { if (res.code == 1) { if (null != res.data) { window.open(res.data.path) } } }).catch(error => { console.log(error); }); 来源: oschina 链接: https://my.oschina.net/u/3204029/blog/4542305

VUE,axios导出excel乱码解决

爷,独闯天下 提交于 2020-09-30 02:39:08
VUE,axios导出excel乱码解决 最近,公司让我写一个导出excel的功能,由于已经有了前人写好的代码,我就直接拿着他的代码改了一下,结果在前端下载好之后直接出现了乱码问题。 开始我怀疑自己哪里写错了,经过仔细的检查,并没有问题。而且在后台生成的excel并没有任何问题。 后来我以为是读入字节流出现了问题,经过调试对比也是正常的。唯一的问题就是通过后台返回的res出现了乱码。 上网搜索,都说这样写就行了。 和我写的一样。在经过了一天的检查还是无果后,我问了问前辈,原来问题出在这里。 .post ( "/TasksTable/ExportData" , { item: { //传入项目id,根据项目id来 搜素任务 project_id: this.tasksinfo, } , //页的索引和页的长度。 PageSize: this.pageSize, PageIndex: this.currentPage, //定义类型 headers: { "Content-Type" : "application/x-www-form-urlencoded" , } , responseType: 'blob' , } ) 如图所示,我用一个花括号把我传入的数据和 headers、responseType放在了一起,所以headers和responseType无效了。 .post (

[Abp vNext微服务实践]

醉酒当歌 提交于 2020-09-29 05:54:05
简介 之前的技术路线本来是angular的,后来经过一段时间的开发还是打算选择vue,原因是vue简单丰富,尽管angular规范强大,但是组件库都不太符合国人风格。看到GitHub上Vue Element Admin这么高的人气后就毫不犹豫的选择了这个后台管理框架。作为一个后端开发,刚刚下载Vue Element Admin框架时确实无从下手,但是一番研究之后也就适应了,今天就介绍下改造Vue Element Admin登录并对接vNext授权服务。vNext授权服务使用的是ids4框架,所以使用ids4框架授权的服务都可以参考该登录。 代码分析 根据Vue Element Admin作者的介绍,该框架登录需要两步,获取token和获取userinfo(用户信息)。Vue Element Admin作者公司的后端设计应该是用户信息中包括用户权限,所以Vue Element Admin(后称Admin)登录只需调两次接口。 在view路径的login中可以看到login的click事件: handleLogin() { this .$refs.loginForm.validate(valid => { if (valid) { this .loading = true this .$store.dispatch("user/userLogin", this .loginForm)

Vue实现页面导航实战

流过昼夜 提交于 2020-09-27 23:57:15
目录 一 使用技术栈 二 创建项目 三 准备资源文件 四 安装axios 五 代码 六 测试 七 源码参考 一 使用技术栈 1 组件及组件间传值 2 axios实现读取json数据:商品数据源存于json中 3 css相关技术进行布局:布局、间距等样式 4 使用views页面级组件,使用router设置页面 二 创建项目 1 创建项目 F:\vue\proj>vue create proj 2 选择必要组件 ? Check the features needed for your project: (*) Babel ( ) TypeScript ( ) Progressive Web App (PWA) Support (*) Router ( ) Vuex ( ) CSS Pre-processors >( ) Linter / Formatter ( ) Unit Testing ( ) E2E Testing 3 选择history模式 ? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) y 4 选择使用package.json来记录 ? Where do you prefer placing config for Babel