Vue add del
How do I make an vue add del?
What is a vue add del? How do you make a vue add del? This script and codes were developed by Eric on 07 December 2022, Wednesday.
Vue add del - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>vue add del</title>
</head>
<body>
<div id="app"> <div> <h4>增加項目</h4> <input type="text" placeholder="輸入品名..." v-model="name"/> <input type="number" placeholder="輸入價格..." v-model="price"/> <input type="button" value="add" @click="insertFn"/> </div> <hr/> <h4>列表</h4> <table border="1"> <tr> <th>編號</th> <th>品名</th> <th>價格</th> <th>刪除</th> </tr> <tr v-for="(item, index) in items"> <td>{{index+1}}</td> <td>{{item.name}}</td> <td>{{item.price | currency}}</td> <td> <input type="button" value="X" @click="delFn(index)"/> </td> </tr> </table>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Vue add del - Script Codes JS Codes
var app = new Vue({ el: '#app', data: { name: '', price: '', items: [ {name: 'pen', price: '15'}, {name: 'book', price: '10'} ] }, methods: { insertFn: function(){ this.items.push({name: this.name, price: this.price}); this.name = ''; this.price = ''; }, delFn: function(index){ this.items.splice(index, 1) } }
});
Developer | Eric |
Username | ericyericy |
Uploaded | December 07, 2022 |
Rating | 3 |
Size | 2,236 Kb |
Views | 12,144 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Transition-duration | 1,935 Kb |
CSS resume | 6,784 Kb |
Pen,pineapple,apple | 3,333 Kb |
V-on | 3,337 Kb |
Brand Guideline | 4,033 Kb |
A Pen by Eric | 1,212 Kb |
Vue | 4,864 Kb |
NameCard | 2,801 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Mostly Fluid | Mccreath | 3,308 Kb |
A Pen by Mike Otis | Mikeotis | 3,185 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
A Bouncy Menu Toggle | Billyysea | 4,563 Kb |
AngularJS Skills | Supro | 3,312 Kb |
3D flipping card | Ssaakkaa | 2,238 Kb |
Tumblr API | Juanv911 | 2,436 Kb |
Two joint circles - One element | Berdejitendra | 1,704 Kb |
Loader | MikitaLisavets | 3,321 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!