This article example shares the specific code of Vue to verify whether the username is available for your reference. The specific content is as follows Verify that the username is availableCase EffectImplementation steps (ideas) 1. Data binding through v-model Further adjustments are 1. Use a listener to monitor changes in user names CodeBasic layout <div id="app"> <span>Username:</span> <span> <input type="text" v-model.lazy="uname"> </span> <span> {{tip}} </span> </div> Implement specific functions through listeners <script type="text/javascript" src="../js/vue.js"></script> <script type="text/javascript"> /* Listener uses the listener to monitor changes in the user name. If the user name changes (call the background interface for verification) Adjust the prompt information according to the verification results*/ var vm = new Vue({ el: "#app", data: { uname: '', tip: '' }, methods: { checkName: function (uname) { //Call the interface, but you can use the scheduled task to simulate the interface call var that = this; setTimeout(function () { // Simulate interface call if (uname == 'admin') { that.tip = 'The user name already exists, please change it' } else { that.tip = 'Username can be used' } }, 1000) } }, watch: uname: function (val) { //Call the backend interface to verify the legitimacy of the user name this.checkName(val); this.tip = 'Verifying...' } }, }); </script> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Steps to install MySQL 5.7.10 on Windows server 2008 r2
>>: Detailed explanation of crontab scheduled execution command under Linux
Table of contents 1. Preparation 2. Introduction ...
Table of contents 1. Introduction 2. Main text 2....
I want to make a docker for cron scheduled tasks ...
Table of contents Preface 1. Get the current time...
The same server simulates the master-slave synchr...
1. InnoDB storage engine must be used It has bett...
Execute the command: docker run --name centos8 -d...
1. Introduction to MariaDB and MySQL 1. Introduct...
Use Code Cloud to build a Git code storage wareho...
Use the following command to check whether MySQL ...
1. Upload rz to the server and decompress it rz [...
Docker supports running on the following CentOS v...
There are two ways to delete data in MySQL, one i...
Table of contents aforementioned VARCHAR Type VAR...
Preface To help ensure that your web pages have a ...