怎么在vue中利用iview實現(xiàn)一個彈框?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
成都創(chuàng)新互聯(lián)公司2013年成立,先為吉首等服務建站,吉首等地企業(yè),進行企業(yè)商務咨詢服務。為吉首企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。1、iView的特性
1) 高質(zhì)量、功能豐富
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搭建了一個項目,用的環(huán)境都是1.0版本,在使用iview彈框中,由于需要先進行彈框中表單的驗證,驗證通過才調(diào)用后臺接口,但是呢,iview彈框中的確定按鈕點擊一下彈框就消失了,怎么辦,要實現(xiàn)效果,各種翻看資料,最終解決辦法如下:
<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(){ //調(diào)用發(fā)送驗證碼接口 // 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 = "發(fā)送" 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實現(xiàn)一個彈框問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注創(chuàng)新互聯(lián)成都網(wǎng)站設計公司行業(yè)資訊頻道了解更多相關知識。
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
名稱欄目:怎么在vue中利用iview實現(xiàn)一個彈框-創(chuàng)新互聯(lián)
本文路徑:http://muchs.cn/article12/cdipdc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、面包屑導航、品牌網(wǎng)站建設、微信小程序、外貿(mào)建站、自適應網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)