廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:
成都創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括嫩江網(wǎng)站建設(shè)、嫩江網(wǎng)站制作、嫩江網(wǎng)頁(yè)制作以及嫩江網(wǎng)絡(luò)營(yíng)銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,嫩江網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到嫩江省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
<!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>異步參數(shù)上傳</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 class="robot-b-name"> <a class=".btn btn-primary" href="">返回上傳頁(yè)面</a> </div> <br> <form @submit.prevent="submit" class="well form-inline"> <input type="text" class="input-big" v-model.trim="batchInforRequestVO.appkey" placeholder="請(qǐng)輸入appkey"> <input type="text" class="input-group" v-model.trim="batchInforRequestVO.batchnum" placeholder="請(qǐng)輸入批次號(hào)"> <input type="hidden" class="input-group" 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"> <h5 class="confirm-header"> <i class="iconfont icon-questioncircle"></i> {{ title }} </h5> <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"> <h5 class="confirm-header"> <i class="iconfont icon-questioncircle"></i> {{ title }} </h5> <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>查詢結(jié)果</div> <!-- TableBegining --> <div> <table class="table table-striped table-bordered table-condensed"> <tr> <th>批次號(hào)</th> <th>處理進(jìn)度</th> <th>文件名稱</th> <th>上傳時(shí)間</th> <th>請(qǐng)求方法</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" >導(dǎo)出 </a><a v-on:click="redirectTo(index)" id="opreat" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >自定義導(dǎo)出 </a></td> </tr> </table> </div> <!-- TableEnding --> <!-- 分頁(yè)部分Begining --> <div class="span6" > <div id="DataTables_Table_0_length"> <span> 每頁(yè)10條記錄 當(dāng)前頁(yè){{batchInforRequestVO.currentPage}}</span>   <span>共{{totalPage}}頁(yè) <a id="previousPage" v-on:click="changePage(1)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >←上一頁(yè)</a>   <a id="nextPage" v-on:click="changePage(2)" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >下一頁(yè) →</a></span> </div> </div> <!-- 分頁(yè)部分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: '批量數(shù)據(jù)處理', 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 = '已經(jīng)是首頁(yè)啦!'; 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 = '已經(jīng)是尾頁(yè)啦!'; return } this.submit(); } }, checkparam: function () { if (this.batchInforRequestVO.appkey == '' && this.batchInforRequestVO.batchnum == '') { vue.showcontent = true; vue.content = '查詢參數(shù)不可以為空!'; 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); // 這里才是你的表單數(shù)據(jù) if (!vue.checkparam()) { return } ; //da.append("name", this.name)可以逐次添加多個(gè)參數(shù) $.ajax({ url: '../interface/queryBatchInfor', data: data, type: 'POST', contentType: 'application/json', dataType: 'JSON', // cache: false, processData: false,// 告訴jQuery不要去處理發(fā)送的數(shù)據(jù) // contentType: false,// 告訴jQuery不要去設(shè)置Content-Type請(qǐng)求頭 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 = '系統(tǒng)內(nèi)部錯(cuò)誤'; } }) }, 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 = '進(jìn)行中......'; debugger var index = $index; // window.location.href = $context.ctx + "../interface/to_autoconfig?batchNum="+ this.BatchInforResponseVO[index].batchNum; } } })
以上所述是小編給大家介紹的Vue form 表單提交+ajax異步請(qǐng)求+分頁(yè)效果,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)創(chuàng)新互聯(lián)網(wǎng)站的支持!
本文標(biāo)題:Vueform表單提交+ajax異步請(qǐng)求+分頁(yè)效果
分享路徑:http://aaarwkj.com/article24/igssje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、搜索引擎優(yōu)化、服務(wù)器托管、網(wǎng)站營(yíng)銷、定制開發(fā)、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)