Vue form 表单提交+ajax异步请求+分页效果
发布时间 - 2026-01-11 00:46:22 点击率:次废话不多说了,直接给大家贴代码了,具体代码如下所示:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8"/>
<title>异步参数上传</title>
<link rel="stylesheet" type="text/css" href="${ctx }/css/bootstrap.min.css" rel="external nofollow" >
<#--<link href="css/fileinput.css" rel="external nofollow" media="all" rel="stylesheet" type="text/css"/>-->
<link href="${ctx }/css/fileinput.css" rel="external nofollow" media="all" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="${ctx }/css/css.css" rel="external nofollow" />
<#--<link rel="stylesheet" type="text/css" href="${ctx }/css/style.css" rel="external nofollow" />-->
<link rel="stylesheet" type="text/css" href="${ctx }/css/subwelcome.css" rel="external nofollow" />
<script>var $context = {};
$context.ctx = '${ctx}';
$context.resources = '${ctx}/resources';
</script>
</head>
<body>
<div id="app" class="htmleaf-container">
<div class="container kv-main">
<br>
<div style="margin-left: 200px;" class="robot-b-name">
<a class=".btn btn-primary" href="">返回上传页面</a>
</div>
<br>
<form @submit.prevent="submit" class="well form-inline">
<input type="text" class="input-big" style="width: 500px" v-model.trim="batchInforRequestVO.appkey"
placeholder="请输入appkey">
<input type="text" class="input-group" style="width: 500px" v-model.trim="batchInforRequestVO.batchnum"
placeholder="请输入批次号">
<input type="hidden" class="input-group" style="width: 500px"
v-model.trim="batchInforRequestVO.currentPage">
<button type="submit" class="btn btn-info">查询</button>
</form>
<br>
<!--提示框公共部分begining-->
<div class="modal-mask" v-show="show">
<div class="modal-confirm">
<h4 class="confirm-header">
<i class="iconfont icon-questioncircle"></i> {{ title }}
</h4>
<div class="confirm-content">
{{ content }}
</div>
<div class="confirm-btns">
<#--<button class="btn" v-on:click="opt(1)">取 消</button>-->
<button class="btn btn-primary" v-on:click="opt(2)">确 定</button>
</div>
</div>
</div>
<br>
<!--提示框公共部分ending-->
<div class="modal-mask" v-show="showcontent">
<div class="modal-confirm">
<h4 class="confirm-header">
<i class="iconfont icon-questioncircle"></i> {{ title }}
</h4>
<div class="confirm-content">
{{ content }}
</div>
<div class="confirm-btns">
<#--<button class="btn" v-on:click="opt(1)">取 消</button>-->
<button class="btn btn-primary" v-on:click="opt(3)">确 定</button>
</div>
</div>
</div>
<div>查询结果</div>
<!-- TableBegining -->
<div>
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>批次号</th>
<th>处理进度</th>
<th>文件名称</th>
<th>上传时间</th>
<th>请求方法</th>
<th>操作</th>
</tr>
<tr v-for="(batchInforResponseVO, index) in BatchInforResponseVO ">
<td>{{batchInforResponseVO.batchNum}}</td>
<td>{{batchInforResponseVO.processPercentage}}</td>
<td>{{batchInforResponseVO.channelName}}</td>
<td>{{batchInforResponseVO.inserTime}}</td>
<td>{{batchInforResponseVO.requestAddre}}</td>
<td><a id="opreat" v-on:click="defaultExport(index)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >导出 </a><a
v-on:click="redirectTo(index)" id="opreat" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >自定义导出 </a></td>
</tr>
</table>
</div>
<!-- TableEnding -->
<!-- 分页部分Begining -->
<div class="span6" style="width:25%;margin-right: 10px;float: right;">
<div style="width: 500px;" id="DataTables_Table_0_length">
<span> 每页10条记录 当前页{{batchInforRequestVO.currentPage}}</span>  
<span>共{{totalPage}}页 <a id="previousPage" v-on:click="changePage(1)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >←上一页</a>   <a
id="nextPage" v-on:click="changePage(2)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >下一页 →</a></span>
</div>
</div>
<!-- 分页部分Ending -->
</div>
</div>
</div>
</body>
<script type="text/javascript">
window.history.go(1);
</script>
<script src="${ctx }/js/jquery/jquery-2.0.3.min.js"></script>
<script src="${ctx }/js/jquery.form.js"></script>
<script src="${ctx }/js/vue/vue.js"></script>
<script src="${ctx }/js/business/exportconfig.js" type="text/javascript"></script>
</html>
var vue = new Vue({
el: '#app',
data: {
batchInforRequestVO: {
currentPage: 1,
appkey: '',
batchnum: ''
},
show: false,
showcontent: false,
onCancel: false,
onOk: false,
totalPage: 0,
title: '提示框',
content: '加载......',
message: '批量数据处理',
BatchInforResponseVO: []
},
methods: {
refreshTest: function () {
location.reload(true)
},
//输入框增加方法
add: function () {
this.user.names.push({
text: ""
})
},
//输入框删除方法
decrease: function (index) {
if (!index == 0) {
this.user.names.splice(index, 1)
}
},
changePage: function (type) {
if (type == '1') {
debugger
if (this.batchInforRequestVO.currentPage == '1') {
vue.showcontent = true;
vue.content = '已经是首页啦!';
return
}
this.batchInforRequestVO.currentPage--;
this.submit();
}
else if (type == '2') {
this.batchInforRequestVO.currentPage++;
debugger
if (this.batchInforRequestVO.currentPage > this.totalPage) {
this.batchInforRequestVO.currentPage--;
vue.showcontent = true;
vue.content = '已经是尾页啦!';
return
}
this.submit();
}
},
checkparam: function () {
if (this.batchInforRequestVO.appkey == '' && this.batchInforRequestVO.batchnum == '') {
vue.showcontent = true;
vue.content = '查询参数不可以为空!';
return false
}
else {
return true
}
},
opt(type){
this.show = false
if (type == '1') {
if (this.onCancel) this.onCancel()
}
else if (type == '3') {
this.showcontent = false
if (this.onOk) this.onOk()
}
else {
if (this.onOk) this.onOk()
vue.refreshTest();
}
this.onCancel = false
this.onOk = false
document.body.style.overflow = ''
},
submit: function () {
debugger
var data = JSON.stringify(this.batchInforRequestVO); // 这里才是你的表单数据
if (!vue.checkparam()) {
return
}
;
//da.append("name", this.name)可以逐次添加多个参数
$.ajax({
url: '../interface/queryBatchInfor',
data: data,
type: 'POST',
contentType: 'application/json',
dataType: 'JSON',
// cache: false,
processData: false,// 告诉jQuery不要去处理发送的数据
// contentType: false,// 告诉jQuery不要去设置Content-Type请求头
success: function (data) {
debugger
if (data.respCode == 'success') {
vue.BatchInforResponseVO = data.batchInforResponseVOList;
vue.totalPage = data.totalPage;
} else {
vue.show = true;
vue.content = data.respMsg;
}
console.log(data)
},
error: function (data) {
vue.show = true;
vue.content = '系统内部错误';
}
})
},
defaultExport: function ($index) {
debugger
var index = $index;
window.location.href = $context.ctx + "../interface/defaultexcport?batchNum=" + this.BatchInforResponseVO[index].batchNum;
},
redirectTo: function ($index) {
vue.showcontent = true;
vue.content = '进行中......';
debugger
var index = $index;
// window.location.href = $context.ctx + "../interface/to_autoconfig?batchNum="+ this.BatchInforResponseVO[index].batchNum;
}
}
})
以上所述是小编给大家介绍的Vue form 表单提交+ajax异步请求+分页效果,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
# vue
# form
# 表单提交
# ajax异步请求
# ajax
# 分页
# Vue.js实现多条件筛选、搜索、排序及分页的表格功能
# 利用vue + element实现表格分页和前端搜索的方法
# Vue+element-ui 实现表格的分页功能示例
# Vue.js实现分页查询功能
# Vue2.5 结合 Element UI 之 Table 和 Pagination 组件实现分页功能
# vuejs2.0实现一个简单的分页示例
# Vue.js实现无限加载与分页功能开发
# 用Vue写一个分页器的示例代码
# 基于Vue.js的表格分页组件
# vue iview实现分页功能
# 要去
# 给大家
# 请输入
# 上传
# 表单
# 小编
# 输入框
# 逐次
# 多个
# 才是
# 下一页
# 在此
# 上一页
# 说了
# 不可以
# 不多
# 每页
# 尾页
# 数据处理
相关栏目:
【
网站优化151355 】
【
网络推广146373 】
【
网络技术251813 】
【
AI营销90571 】
相关推荐:
英语简历制作免费网站推荐,如何将简历翻译成英文?
如何用PHP快速搭建高效网站?分步指南
Laravel如何部署到服务器_线上部署Laravel项目的完整流程与步骤
宙斯浏览器怎么屏蔽图片浏览 节省手机流量使用设置方法
UC浏览器如何设置启动页 UC浏览器启动页设置方法
如何在服务器上三步完成建站并提升流量?
Laravel怎么实现验证码(Captcha)功能
Laravel如何使用Blade模板引擎?(完整语法和示例)
详解Android中Activity的四大启动模式实验简述
C语言设计一个闪闪的圣诞树
手机网站制作平台,手机靓号代理商怎么制作属于自己的手机靓号网站?
网站制作价目表怎么做,珍爱网婚介费用多少?
米侠浏览器网页图片不显示怎么办 米侠图片加载修复
矢量图网站制作软件,用千图网的一张矢量图做公司app首页,该网站并未说明版权等问题,这样做算不算侵权?应该如何解决?
UC浏览器如何切换小说阅读源_UC浏览器阅读源切换【方法】
Laravel怎么导出Excel文件_Laravel Excel插件使用教程
,在苏州找工作,上哪个网站比较好?
Laravel辅助函数有哪些_Laravel Helpers常用助手函数大全
Laravel怎么设置路由分组Prefix_Laravel多级路由嵌套与命名空间隔离【步骤】
谷歌Google入口永久地址_Google搜索引擎官网首页永久入口
javascript和jQuery中的AJAX技术详解【包含AJAX各种跨域技术】
东莞专业网站制作公司有哪些,东莞招聘网站哪个好?
javascript中的try catch异常捕获机制用法分析
javascript中闭包概念与用法深入理解
ChatGPT常用指令模板大全 新手快速上手的万能Prompt合集
Laravel如何使用模型观察者?(Observer代码示例)
Python3.6正式版新特性预览
Laravel Blade组件怎么用_Laravel可复用视图组件的创建与使用
韩国网站服务器搭建指南:VPS选购、域名解析与DNS配置推荐
微博html5版本怎么弄发语音微博_语音录制入口及时长限制操作【教程】
如何在局域网内绑定自建网站域名?
七夕网站制作视频,七夕大促活动怎么报名?
详解Android图表 MPAndroidChart折线图
Android中Textview和图片同行显示(文字超出用省略号,图片自动靠右边)
Laravel如何使用Scope本地作用域_Laravel模型常用查询逻辑封装技巧【手册】
阿里云高弹*务器配置方案|支持分布式架构与多节点部署
Laravel如何优雅地处理服务层_在Laravel中使用Service层和Repository层
个人摄影网站制作流程,摄影爱好者都去什么网站?
jquery插件bootstrapValidator表单验证详解
如何正确选择百度移动适配建站域名?
Laravel Admin后台管理框架推荐_Laravel快速开发后台工具
免费网站制作appp,免费制作app哪个平台好?
laravel怎么为API路由添加签名中间件保护_laravel API路由签名中间件保护方法
如何在阿里云服务器自主搭建网站?
如何在阿里云域名上完成建站全流程?
Laravel Sail是什么_基于Docker的Laravel本地开发环境Sail入门
历史网站制作软件,华为如何找回被删除的网站?
Laravel安装步骤详细教程_Laravel环境搭建指南
北京企业网站设计制作公司,北京铁路集团官方网站?
Laravel如何使用Passport实现OAuth2?(完整配置步骤)

