


Example analysis of Vue implementation of household registration management system
The example in this article shares with you the specific code of Vue to implement the household registration management system for your reference. The specific content is as follows
Household registration management system, v-model, v- Reference for for
Interface preview
Step ideas:
1.html css creation
2.Introduce vue, example
3.Prepare default data message array
4.Render default data, v-for loop form
5.Create a new data newmessage
6. Bind to the input box v-model
7. Create an add function add() to add new data to the default data, newmessage->message
8. After adding, clear the form and restore newmessage
9. Click who deletes whom del() function
body part:
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <p id = 'app' v-cloak> <legend>户籍管理系统</legend></br> 姓名:<input type="text" placeholder="请输入用户名" v-model = 'newmessage.name'></br> 年龄:<input type="text" placeholder="请输入年龄" v-model = 'newmessage.age'></br> 性别: <select v-model = 'newmessage.sex'> <option>男</option> <option>女</option> </select></br> 手机:<input type="text" placeholder="请输入手机号" v-model = 'newmessage.phone'></br> <button class = 'save' @click = 'add()'>保存至用户</button></br> <table> <tr class = 'title'> <td width = '100px'>姓名</td> <td width = '100px'>性别</td> <td width = '100px'>年龄</td> <td width = '200px'>手机</td> <td width = '100px'>删除</td> </tr> <tr v-for = 'item,index in message'> <td>{{item.name}}</td> <td>{{item.sex}}</td> <td>{{item.age}}</td> <td>{{item.phone}}</td> <td><button @click = 'del(index)'>删除</button></td> </tr> </table> </p>
vue part:
<script> var app = new Vue({ el:'#app', data:{ message:[ { name:'张三', sex:'女', age:16, phone:'1568888811' }, { name:'李四', sex:'男', age:26, phone:'1456666622' }, { name:'王麻子', sex:'女', age:36, phone:'1866666666' }, ], newmessage:{name:'',age:'',sex:'男',phone:''}, }, methods:{ add(){ if(!this.newmessage.name == ''){ this.message.push(this.newmessage); this.newmessage = { name:'', age:'', sex:'男', phone:'' }; } else{ alert('请输入姓名!'); } }, del(index){ this.message.splice(index,1); } } }) </script>
css style:
<style> *{ margin:0; padding:0; } #app{ border: 1px solid black; width:800px; padding:30px 30px; } #app .save{ background-color: #555555; border-radius: 10%; height:50px; color:white; } #app input,select{ margin:10px 0; width:300px; } #app td{ text-align: center; } #app .title td{ background-color: #555555; color:white; } #app table button{ background-color: #555555; color:white; border-radius: 30%; } </style>
Related learning recommendations: javascript video tutorial
The above is the detailed content of Example analysis of Vue implementation of household registration management system. For more information, please follow other related articles on the PHP Chinese website!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Confusion and the cause of choosing from PHP to Go Recently, I accidentally learned about the salary of colleagues in other positions such as Android and Embedded C in the company, and found that they are more...

Explore the implementation of panel drag and drop adjustment function similar to VSCode in the front-end. In front-end development, how to implement VSCode similar to VSCode...

The onBlur event that implements Avue-crud row editing in the Avue component library manually triggers the Avue-crud component. It provides convenient in-line editing functions, but sometimes we need to...

Vue Elementel-upload upload file online error reporting and troubleshooting using Vue and Element...

Title: The relationship between technology stack convergence and selection: Does technology stack convergence refer to the selection of technology stack? I saw an article that has a convergence technology stack...

Discussion on the relationship between technology stack convergence and selection In technology development, problems about technology stack convergence and selection are often encountered. So, is the technology stack converging...

How to achieve upward scrolling loading similar to WeChat chat records? When developing applications similar to WeChat chat records, a common question is how to...

Career choices for PHP developers: to switch to Go or to front-end? In the modern software development industry, the selection of technology stacks and the planning of career development paths are for...
