怎么在vue中利用iview實(shí)現(xiàn)一個(gè)彈框-創(chuàng)新互聯(lián)

怎么在vue中利用iview實(shí)現(xiàn)一個(gè)彈框?針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。

成都創(chuàng)新互聯(lián)公司2013年成立,先為吉首等服務(wù)建站,吉首等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為吉首企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

1、iView的特性

1) 高質(zhì)量、功能豐富
2) 友好的API ,自由靈活地使用空間
3) 細(xì)致、漂亮的 UI
4) 事無巨細(xì)的文檔
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>

由于公司項(xiàng)目需要,所以目前搗鼓了vue+iview搭建了一個(gè)項(xiàng)目,用的環(huán)境都是1.0版本,在使用iview彈框中,由于需要先進(jìn)行彈框中表單的驗(yàn)證,驗(yàn)證通過才調(diào)用后臺(tái)接口,但是呢,iview彈框中的確定按鈕點(diǎn)擊一下彈框就消失了,怎么辦,要實(shí)現(xiàn)效果,各種翻看資料,最終解決辦法如下:

<template> 
  <!--取消訂單彈框和老板批準(zhǔn)彈框--> 
   <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" >授權(quán)碼</i-col> 
      <i-col span="6"> 
       <input class="ivu-input errorInput" type="number" v-model="code" placeholder="請(qǐng)輸入" @blur="codeBlur"> 
       <div class="fade-transition ivu-form-item-error-tip error" >驗(yàn)證碼錯(cuò)誤</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,//點(diǎn)擊申請(qǐng)取消按鈕后loading 
        btnText:'申請(qǐng)取消訂單', 
        code:"",//驗(yàn)證碼 
        clearTime:"",//定時(shí)器 
        countDownIndex:60,//60秒倒計(jì)時(shí) 
      } 
    }, 
    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ā)送驗(yàn)證碼接口 
   //      let operName = window.sessionStorage.getItem("userName") 
            // accountService.recommenderGetCode(operName,this.selectDelteOne.recommender,1) 
          this.countDown()   
 
      }, 
      countDown(){ 
          //倒計(jì)時(shí) 
          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>

關(guān)于怎么在vue中利用iview實(shí)現(xiàn)一個(gè)彈框問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

名稱欄目:怎么在vue中利用iview實(shí)現(xiàn)一個(gè)彈框-創(chuàng)新互聯(lián)
本文路徑:http://bm7419.com/article12/cdipdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、面包屑導(dǎo)航、品牌網(wǎng)站建設(shè)、微信小程序外貿(mào)建站、自適應(yīng)網(wǎng)站

廣告

聲明:本網(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)

成都app開發(fā)公司