How to write a pop-up box in vue+iview (detailed tutorial)
This article mainly introduces the sample code for writing a pop-up box in vue iview. The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor and take a look.
iView is a set of open source UI component libraries based on Vue.js, which mainly serves mid- and back-end products of PC interfaces.
1. Features of iView
1) High quality, rich functions
2) Friendly API, free and flexible use of space
3) Detailed , Beautiful UI
4) Detailed documentation
5) Customizable themes
2. iView installation:
1) Use npm:
npm install --save iview
2) CDN introduction:
<link rel="stylesheet" href="css/iview.css" rel="external nofollow" > <script src="js/iview.min.js"></script>
Due to the needs of the company's project, I have currently built a project with vue iview. The environment used is version 1.0. I am using the iview pop-up box. , since the form in the pop-up box needs to be verified first, the background interface will be called only after the verification is passed. However, the pop-up box disappears after clicking the OK button in the iview pop-up box. What should I do? To achieve the effect, browse the information in various ways , the final solution is as follows:
<template> <!--取消订单弹框和老板批准弹框--> <Modal :visible.sync="show" title="提示" :loading="loading" @on-ok="asyncOK"> <Row> <i-col span="3"></i-col> <i-col span="1" style="color:red;margin-top:7px;font-weight: bold">*</i-col> <i-col span="2" style="margin-top:5px;">授权码</i-col> <i-col span="6"> <input class="ivu-input errorInput" type="number" v-model="code" placeholder="请输入" @blur="codeBlur"> <p class="fade-transition ivu-form-item-error-tip error" style="display:none;position: static">验证码错误</p> </i-col> <i-col span="3" style="margin-left:5px;"> <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>
The general idea is to first name a variable loading, which must be true, and then when clicking the submit button of the pop-up box, first set loading to false, and then you must add
this.$nextTick(() => { this.loading = true;}); can achieve the effect. The specific implementation principle. If you encounter this pitfall, record it first
Transmission Door-->https://github.com/iview/iview/issues/597#issuecomment-292422473
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to implement OAuth2.0 authorization service authentication in nodejs
How to implement the message board function in JS
How to determine holidays in js
The above is the detailed content of How to write a pop-up box in vue+iview (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor