怎么在vue中利用iview實現一個彈框?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
成都創新互聯公司2013年成立,先為吉首等服務建站,吉首等地企業,進行企業商務咨詢服務。為吉首企業網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。1、iView的特性
1) 高質量、功能豐富
2) 友好的API ,自由靈活地使用空間
3) 細致、漂亮的 UI
4) 事無巨細的文檔
5) 可自定義主題
2、iView的安裝:
1) 使用npm:
npm install --save iview
2) CDN引入:
<link rel="stylesheet" href="css/iview.css" rel="external nofollow" > <script src="js/iview.min.js"></script>
由于公司項目需要,所以目前搗鼓了vue+iview搭建了一個項目,用的環境都是1.0版本,在使用iview彈框中,由于需要先進行彈框中表單的驗證,驗證通過才調用后臺接口,但是呢,iview彈框中的確定按鈕點擊一下彈框就消失了,怎么辦,要實現效果,各種翻看資料,最終解決辦法如下:
<template> <!--取消訂單彈框和老板批準彈框--> <Modal :visible.sync="show" title="提示" :loading="loading" @on-ok="asyncOK"> <Row> <i-col span="3"></i-col> <i-col span="1" >*</i-col> <i-col span="2" >授權碼</i-col> <i-col span="6"> <input class="ivu-input errorInput" type="number" v-model="code" placeholder="請輸入" @blur="codeBlur"> <div class="fade-transition ivu-form-item-error-tip error" >驗證碼錯誤</div> </i-col> <i-col span="3" > <i-button type="primary" :loading="loadingBtn" @click="toLoading"> <span v-if="!loadingBtn">{{btnText}}</span> <span v-else>{{btnText}}</span> </i-button> </i-col> </Row> </Modal> </template> <script type="text/javascript"> import { orderService } from 'jo' export default { props:["show"], data(){ return { loading:true, loadingBtn:false,//點擊申請取消按鈕后loading btnText:'申請取消訂單', code:"",//驗證碼 clearTime:"",//定時器 countDownIndex:60,//60秒倒計時 } }, methods:{ codeBlur(){ if(this.code == ""){ $(".errorInput").css("border","1px solid red") $(".error").css("display","block") }else{ $(".errorInput").css("border","1px solid #d7dde4") $(".error").css("display","none") } }, toLoading(){ //調用發送驗證碼接口 // let operName = window.sessionStorage.getItem("userName") // accountService.recommenderGetCode(operName,this.selectDelteOne.recommender,1) this.countDown() }, countDown(){ //倒計時 var that = this; that.loadingBtn = true that.btnText = that.countDownIndex+"秒" that.countDownIndex--; that.clearTime = setInterval(function(){ console.log(that.countDownIndex) if(that.countDownIndex == 0){ that.countDownIndex = 60 that.btnText = "發送" that.loadingBtn = false window.clearTimeout(that.clearTime) return false } that.btnText = that.countDownIndex+"秒" that.countDownIndex--; },1000) // } }, asyncOK(){ //提交 if(this.code == ""){ this.show = true console.log('sdasda'+this.show) $(".errorInput").css("border","1px solid red") $(".error").css("display","block") this.loading = false this.$nextTick(() => { this.loading = true;}); return } this.$nextTick(() => {this.loading = true; }); // let operId = window.sessionStorage.getItem("crmUserId") // let operName = window.sessionStorage.getItem("userName") // if(this.isApply){ // orderService.sendSingleUpdate03(this.data, 3, operName, operId, this.code).then(res => this.updateList(res.message)) // }else{ // orderService.sendSingleUpdate03(this.data, 2, operName, operId, this.code).then(res => this.updateList(res.message)) // } } } } </script>
關于怎么在vue中利用iview實現一個彈框問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注創新互聯成都網站設計公司行業資訊頻道了解更多相關知識。
另外有需要云服務器可以了解下創新互聯scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
名稱欄目:怎么在vue中利用iview實現一個彈框-創新互聯
本文路徑:http://vcdvsql.cn/article12/cdipdc.html
成都網站建設公司_創新互聯,為您提供App開發、面包屑導航、品牌網站建設、微信小程序、外貿建站、自適應網站
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯