SoFunction
Updated on 2025-04-04

Add click on the vue implementation list

This article has shared the addition clicks of the vue implementation list for your reference. The specific content is as follows

Use commands:v-on v-for v-on v-bind v-model

html

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title></title>
 <style>
  body {font-family: "\5FAE\8F6F\96C5\9ED1"}
  .red {color: red;}
  body > div {
   width: 200px;
   margin: 50px auto;
  }
 </style>
</head>
<body>
 <div >
  <h3>vue——Adding list</h3>
  <input type="text" v-model="newitem" v-on:="clickKey">
  <ul>
   <li v-for="item in items" v-text="" 
   v-bind:class="{red:}" v-on:click="liClick(item)"></li>
  </ul>
 </div>
 <script src="/vue/dist/"></script>
 <script src=""></script>
</body>
</html>

js

 = function() {
 ("todo-item", {
  props: ["todo"],
  template: "<li>{{}}</li>"
 })
 var app = new Vue({
  el: '#app',
  data: {
  items: [
  ],
  newitem: ''
  },
  methods: {
  liClick: function (item) {
    = !;
  },
  clickKey: function () {
   ({
    event: ,
    isFinish: false
   })
    = '';
  }
  }
 });
}

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.