layer彈出層自定義提交取消按鈕的例子
首先從js開(kāi)始
/** * 檢查是否選中 */ Sendandre.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if (selected.length === 0) { Feng.info("請(qǐng)先選中表格中的某一記錄!"); return false; } else { Sendandre.seItem = selected[0]; console.log(Sendandre.seItem); return true; } }; /** * 點(diǎn)擊修改按鈕時(shí) */ Sendandre.openChangestan = function () { if (this.check()) { this.layerIndex = layer.open({ type: 2, title: '修改收派標(biāo)準(zhǔn)', area: ['800px', '400px'], //寬高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/sendandreceive/stander_edit?sendid=' + this.seItem.sendid, success: function (layero, index) { //成功獲得加載changefile.html時(shí) //// console.log(obj.data.editAble); var body = layer.getChildFrame('body', index); //console.log(rowselect[0].filename); body.find(".sendname").val(Sendandre.seItem.sendname); //通過(guò)class名進(jìn)行獲取數(shù)據(jù) body.find(".minwe").val(Sendandre.seItem.minwe); body.find(".maxwe").val(Sendandre.seItem.maxwe); } }); } };
然后是彈出層加載的界面
@layout("/common/_dialog.html",{plugins:["laydate","sweet-alert","layer"],js:["/assets/modular/system/basic/sendandre/send_edit.js"]}){ <div class="container-fluid"> <form id="sendandreForm"> <div class="row"> <div class="col-6"> <div class="form-group"> <h5>標(biāo)準(zhǔn)名稱 <span class="text-danger">*</span></h5> <div class="controls"> <input name="sendname" type="text" class="form-control sendname" id="sendname"> </div> </div> <div class="form-group"> <h5>最小重量 <span class="text-danger">*</span></h5> <div class="controls"> <input name="minwe" type="text" class="form-control minwe" id="minwe"> </div> </div> <div class="form-group"> <h5>最大重量 </h5> <div class="controls"> <input name="maxwe" type="text" class="form-control maxwe" id=""> </div> </div> </div> </div> <div class="row"> <div class="col-6"> <div class="text-xs-right"> <button class="btn btn-info normal-button-width" onclick="ensure()">提交</button> <button class="btn btn-inverse normal-button-width m-l-10" onclick="closehe()">取消</button> </div> </div> </div> </form> </div> @}
然后是js函數(shù)實(shí)現(xiàn)
/** * 關(guān)閉此對(duì)話框 */ closehe = function () { console.log("close"); // var inde=parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name); console.log(index); parent.layer.close(index); }; ensure = function () { console.log("daodao"); };
途中有一個(gè)錯(cuò)誤就是把函數(shù)名稱成為close()了,這個(gè)和關(guān)鍵字重復(fù)了,導(dǎo)致沒(méi)有效果出現(xiàn),關(guān)閉不了。
以上這篇layer彈出層自定義提交取消按鈕的例子就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
javascript垃圾收集機(jī)制與內(nèi)存泄漏詳細(xì)解析
本文是對(duì)javascript中的垃圾收集機(jī)制與內(nèi)存泄漏進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2013-11-11使用JS實(shí)現(xiàn)在空白頁(yè)上展示出一個(gè)有趣的時(shí)鐘
在我們?nèi)粘5木W(wǎng)頁(yè)瀏覽中,空白的頁(yè)面往往會(huì)被視為一種無(wú)趣的事物,一片等待填充的空間,今天我們來(lái)學(xué)習(xí)一下如何使用JS在空白的網(wǎng)頁(yè)上展示出一個(gè)有趣的時(shí)鐘吧,感興趣的小伙伴跟著小編一起來(lái)看看吧2024-04-04node.js 一個(gè)簡(jiǎn)單的頁(yè)面輸出實(shí)現(xiàn)代碼
最近決定重拾node.js,用它來(lái)做一個(gè)合并JS文件的東西。由于忘得差不多了,先看能不能輸出一個(gè)頁(yè)面來(lái)再說(shuō)。以下是我的一些筆記,省得以后又忘凈光2012-03-03微信小程序?qū)崿F(xiàn)跳轉(zhuǎn)的幾種方式總結(jié)(推薦)
這篇文章主要介紹了微信小程序跳轉(zhuǎn)方式,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04代碼短小的js div層拖動(dòng)實(shí)現(xiàn)代碼[兼容IE與Firefox]
代碼短小的js div層拖動(dòng)實(shí)現(xiàn)代碼[兼容IE與Firefox],需要的朋友可以參考下.2010-05-05JavaScript如何將時(shí)間戳轉(zhuǎn)化為年月日時(shí)分秒格式
這篇文章主要給大家介紹了關(guān)于JavaScript如何將時(shí)間戳轉(zhuǎn)化為年月日時(shí)分秒格式的相關(guān)資料,在前端的日常工作當(dāng)中,時(shí)間戳的使用也是不少的,有時(shí)后端返回給我們的數(shù)據(jù)是一個(gè)時(shí)間戳,我們需要轉(zhuǎn)換成年月日,時(shí)分秒的形式展示在頁(yè)面當(dāng)中,需要的朋友可以參考下2023-11-11js超時(shí)調(diào)用setTimeout和間歇調(diào)用setInterval實(shí)例分析
這篇文章主要介紹了js超時(shí)調(diào)用setTimeout和間歇調(diào)用setInterval,以實(shí)例形式對(duì)比分析了setTimeout與setInterval的具體使用技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-01-01當(dāng)鼠標(biāo)滑過(guò)超鏈接出現(xiàn)提示框效果實(shí)例
當(dāng)鼠標(biāo)滑過(guò)超鏈接出現(xiàn)提示框效果實(shí)例,需要的朋友可以參考一下2013-04-04