handleSizeChange(val) { console.log(`每页 ${val} 条`); var _this = this _this.pageSize = val _this.token = sessionStorage.getItem("token") axios.get('http://localhost:8082/event/eventForm?page=' + _this.page +'&pageSize=' +_this.pageSize, { headers:{ 'token': _this.token } }) .then(function (ref) { console.log(ref.data) _this.tableData = ref.data.data.records _this.total = ref.data.data.total-0 }) }, handleCurrentChange(val) { console.log(`当前页: ${val}`); var _this = this _this.token = sessionStorage.getItem("token") _this.page = val axios.get('http://localhost:8082/event/eventForm?page=' + _this.page +'&pageSize=' +_this.pageSize, { headers:{ 'token': _this.token } }) .then(function (ref) { console.log(ref.data) _this.tableData = ref.data.data.records _this.total = ref.data.data.total-0 }) },
时间: 2024-02-14 13:09:47 浏览: 42
这是一个使用了 Vue.js 和 Axios 库的前端分页查询的方法。其中,handleSizeChange 方法用于在每页显示条数发生变化时触发,通过发送请求到后端,获取指定页码和指定每页显示条数的数据,同时更新表格的数据和总记录数。handleCurrentChange 方法用于在当前页发生变化时触发,同样通过发送请求到后端,获取指定页码和指定每页显示条数的数据,同时更新表格的数据和总记录数。这个分页查询的实现需要后端提供相应的接口支持,同时需要前端进行相应的参数配置和数据渲染。
相关问题
handleSizeChange(val) { console.log(`每页 ${val} 条`); this.pageNum=1 this.pageSize=val this.loadPost() }, handleCurrentChange(val) { console.log(`当前页: ${val}`); this.pageNum=val this.loadPost()
这段代码看起来像是 Vue.js 的一个分页组件的事件处理函数。其中 handleSizeChange 函数会在用户改变每页显示条数时触发,handleCurrentChange 函数会在用户翻页时触发。这两个函数都会调用 loadPost 函数重新加载数据。具体实现细节需要查看 loadPost 函数的代码。
for(var i=1;i<=goodCount;i++) { console.log($("#goodNumber_"+i).val()); $("#goodNumber_"+i).change(function (){ console.log($(this).val()); console.log($(this).attr("tag")) var xj=parseFloat($('#goodPrice_'+$(this).attr("tag")).val())*parseInt($(this).val()); $("#goodXj_"+$(this).attr("tag")).html(xj); getZj(); }); }这段代码是什么意思
这段代码是用来实现购物车商品数量和小计金额的动态计算。首先,通过一个循环遍历每一个商品的数量输入框,然后给每一个输入框绑定了一个change事件。当用户修改商品数量时,会触发该事件,然后通过获取当前输入框的值以及对应商品价格,计算出该商品的小计金额,并将其赋值给对应的小计标签。最后调用getZj()函数计算出所有商品的总价。其中,$(this)表示当前被修改的输入框,$(this).val()表示获取当前输入框的值,$(this).attr("tag")表示获取当前输入框的自定义属性tag的值,用于获取对应的商品价格和小计标签。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)