this.$http.get('quxiaogoupiao/list', {params: Object.assign(params, searchWhere)}).then(res => { if (res.data.code == 0) { this.dataList = res.data.data.list; this.total = res.data.data.total; this.pageSize = res.data.data.pageSize; this.totalPage = res.data.data.totalPage; this.pageSizes = [this.pageSize, this.pageSize*2, this.pageSize*3, this.pageSize*5]; } });

时间: 2023-12-06 13:40:10 浏览: 40
这段代码是使用 Vue.js 发送 GET 请求获取数据。其中,`this.$http.get` 方法是 Vue.js 封装的一个 HTTP 请求方法,用于发送 GET 请求。请求的 URL 是 `quxiaogoupiao/list`,参数是 `params` 和 `searchWhere` 对象的合并。请求成功后,会将返回的数据中的 `dataList`、`total`、`pageSize` 和 `totalPage` 四个属性分别赋值给 Vue 实例中的对应属性,同时,还会将 `pageSize` 值分别赋值给 `pageSizes` 数组中的四个元素,以便在分页组件中使用。如果返回的数据中的 `code` 值不为 0,则不做任何操作。
相关问题

this.$http.get('quxiaogoupiao/list', {params: Object.assign(params, searchWhere)})

这段代码使用了 Vue.js 提供的 $http 对象,发送了一个 GET 请求到地址 'quxiaogoupiao/list',并且传递了两个参数: 1. params: 一个对象,包含请求的参数。 2. searchWhere: 另一个对象,包含搜索条件的参数。 其中,Object.assign() 方法会将两个对象合并成一个新对象,相同属性名的值会被后面的对象的值覆盖。最终的请求参数会包含 params 和 searchWhere 的所有属性。

getList(page, fenlei, ref = '') { let params = {page, limit: this.pageSize}; let searchWhere = {}; if (this.formSearch.jingdianmingcheng != '') searchWhere.jingdianmingcheng = '%' + this.formSearch.jingdianmingcheng + '%'; this.$http.get('quxiaogoupiao/list', {params: Object.assign(params, searchWhere)}).then(res => { if (res.data.code == 0) { this.dataList = res.data.data.list; this.total = res.data.data.total; this.pageSize = res.data.data.pageSize; this.totalPage = res.data.data.totalPage; this.pageSizes = [this.pageSize, this.pageSize*2, this.pageSize*3, this.pageSize*5]; } }); },

这是一个前端Vue.js的方法,用于从后端API获取数据并更新页面。参数`page`表示当前页码,`fenlei`表示分类,`ref`表示引用,但似乎没有被使用。方法中首先定义了一个`params`对象,用于存储请求参数,包括当前页码和每页数据条数。然后定义了一个`searchWhere`对象,用于存储搜索条件。如果搜索条件中包含景点名称,则将`searchWhere.jingdianmingcheng`设置为包含该名称的字符串。最后使用`this.$http.get`方法发送GET请求,请求地址为`'quxiaogoupiao/list'`,请求参数为`params`和`searchWhere`对象的合并结果。当请求成功后,如果返回的`code`为0,则更新页面数据和分页信息。其中`this.dataList`表示当前页的数据列表,`this.total`表示数据总条数,`this.pageSize`表示每页数据条数,`this.totalPage`表示总页数,`this.pageSizes`表示可选的每页数据条数选项。

相关推荐

getList(page, fenlei, ref = '') { if(fenlei == '全部') //首先判断分类是否为“全部” this.swiperIndex = -1;//如果是则把swiperIndex设置为-1 for(let i=0;i<this.fenlei.length;i++) {//遍历分类数组this.fenlei,找到对应的分类 if(fenlei == this.fenlei[i]) { this.swiperIndex = i;//把swiperIndex设置为对应的索引值 break; } } this.curFenlei = fenlei;//将当前分类赋值给curFenlei(当前分类)变量 if (this.curFenlei == '全部') {//根据curFenlei是否为“全部”来决定是否设置isPlain变量为false或true this.isPlain = false; } else { this.isPlain = true; } let params = {page, limit: this.pageSize}; let searchWhere = {}; if (this.formSearch.jingdianmingcheng != '') searchWhere.jingdianmingcheng = '%' + this.formSearch.jingdianmingcheng + '%'; if (this.formSearch.jingdiandizhi != '') searchWhere.jingdiandizhi = '%' + this.formSearch.jingdiandizhi + '%'; if(this.formSearch.menpiaojiagestart!='' && this.formSearch.menpiaojiagestart!=undefined ){ searchWhere.menpiaojiagestart = this.formSearch.menpiaojiagestart } if(this.formSearch.menpiaojiageend!='' && this.formSearch.menpiaojiageend!=undefined){ searchWhere.menpiaojiageend = this.formSearch.menpiaojiageend } if (this.curFenlei != '全部') searchWhere.jingdianleixing = this.curFenlei; this.$http.get('lvyoujingdian/list', {params: Object.assign(params, searchWhere)}).then(res => { if (res.data.code == 0) { this.dataList = res.data.data.list; this.total = res.data.data.total; this.pageSize = res.data.data.pageSize; this.totalPage = res.data.data.totalPage; this.pageSizes = [this.pageSize, this.pageSize*2, this.pageSize*3, this.pageSize*5]; } }); },

优化这段代码 if ( this.queryParam.tonnageOne == '' || this.queryParam.tonnageTwo == '' || this.queryParam.tonnageThree == '' || this.dataSource.some((item) => !item.feiGangName) || this.dataSource.some((item) => !item.feiGangPrice) || this.dataSourceFeWater.some((item) => !item.tscfhcbName) || this.dataSourceFeWater.some((item) => !item.temp) || this.dataSourceFeWater.some((item) => !item.tscfhcb_C) || this.dataSourceFeWater.some((item) => !item.tscfhcb_Si) || this.dataSourceFeWater.some((item) => !item.tscfhcb_Mn) || this.dataSourceFeWater.some((item) => !item.tscfhcb_P) || this.dataSourceFeWater.some((item) => !item.tscfhcb_S) || this.dataSourceFeWater.some((item) => !item.tscfhcb_Price) ) { this.$message.error('请检查值,或者名称不能为空!!!') } else { this.dataSource.forEach((item) => { item['acoursewareId'] = 3343772731908188 const editableItem = this.editableData[item.id] if (editableItem) { Object.assign(item, editableItem) } }) this.editableData = [] this.dataSourceFeWater.forEach((item) => { item['acoursewareId'] = 3343772731908188 const editableItem = this.editableDataFeWater[item.id] if (editableItem) { Object.assign(item, editableItem) } }) this.editableDataFeWater = [] console.log(this.dataSourceFeWater) // 清空可编辑数据 this.conceal = false this.concealFeWater = false var addZldwInfo = { AcoursewareId: 3343772731908188, tons1: this.queryParam.tonnageOne, tons2: this.queryParam.tonnageTwo, tons3: this.queryParam.tonnageThree, } let param = { addZldwInfo: addZldwInfo, addFgList: this.dataSource, b_TscfhcbListAdd: this.dataSourceFeWater, } FeAdd(param) .then((res) => {}) .catch((error) => {}) }

最新推荐

recommend-type

JavaScript对象拷贝与Object.assign用法实例分析

本文实例讲述了JavaScript对象拷贝与Object.assign用法。分享给大家供大家参考,具体如下: 深拷贝与浅拷贝 在 JavaScript 中,对于基本数据类型(undefined、null、boolean、number、string)来说,在变量中存储的...
recommend-type

基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出

基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出 基于随机森林的数据分类预测Matlab程序RF 多特征输入多类别输出
recommend-type

Go微服务教程项目使用领域驱动设计和洋葱架构.zip

Go微服务教程项目使用领域驱动设计和洋葱架构
recommend-type

520表白的表白的代码

520了表白成功我只能说520快乐了520快乐520祝您表白成功
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

深入了解MATLAB开根号的最新研究和应用:获取开根号领域的最新动态

![matlab开根号](https://www.mathworks.com/discovery/image-segmentation/_jcr_content/mainParsys3/discoverysubsection_1185333930/mainParsys3/image_copy.adapt.full.medium.jpg/1712813808277.jpg) # 1. MATLAB开根号的理论基础 开根号运算在数学和科学计算中无处不在。在MATLAB中,开根号可以通过多种函数实现,包括`sqrt()`和`nthroot()`。`sqrt()`函数用于计算正实数的平方根,而`nt
recommend-type

react的函数组件的使用

React 的函数组件是一种简单的组件类型,用于定义无状态或者只读组件。 它们通常接受一个 props 对象作为参数并返回一个 React 元素。 函数组件的优点是代码简洁、易于测试和重用,并且它们使 React 应用程序的性能更加出色。 您可以使用函数组件来呈现简单的 UI 组件,例如按钮、菜单、标签或其他部件。 您还可以将它们与 React 中的其他组件类型(如类组件或 Hooks)结合使用,以实现更复杂的 UI 交互和功能。
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依