async getSelectOrg () { console.log('----1') return axiosPost('/api/uum/org/orglist', { accessToken: localStorage.token, option: true}).then(response => { this.options_grade = [] if (response.data.data.length > 1) { this.options_grade.push({ value: '-1', label: '全部' }) this.formInline.organization = '-1' } else if (response.data.data.length === 1) { this.formInline.organization = response.data.data[0].orgCode } for (let i = 0; i < response.data.data.length; i++) { let tmp = {} tmp.value = response.data.data[i].orgCode tmp.label = response.data.data[i].orgName this.options_grade.push(tmp) } console.log('----2') }).catch(err => { console.log(err) }) }, async getSelect () { await this.getSelectOrg() console.log('----3') this.searchInfo() } }, mounted () { let that = this window.onresize = function () { // 定义窗口大小变更通知事件 // _this.screenWidth = document.documentElement.clientWidth // 窗口宽度 that.clientHeight = document.documentElement.clientHeight // 窗口高度 } this.getSelect() },
vue 中多接口请求时 按顺序执行接口使用await async
最新推荐文章于 2024-05-24 20:30:11 发布