SoFunction
Updated on 2025-04-11

Method of processing dynamic data of vue loop list in instance analysis

Call method: ( target, key, value )

target: The data source to be changed (can be an object or an array)

key: the specific data to be changed

value: the reassigned value

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
<div >
  <p v-for="(item,index)in list" :key="" @click="btnClick(index,)">
    {{}}
  </p>
</div>
<script src="../../dist/"></script>
<script>
  var vm2=new Vue({
    el:"#app",
    data:{
      list:[
        {message:"Star",id:"1"},
        {message:"sun",id:"2"},
        {message:"moon",id:"3"}
      ]
    },
    methods:{
      btnClick(index,id){
        this.$set(,index,{message:"kitten",id:id});
      }
    }
  });
</script>
</body>
</html>

The above is all the content of the relevant vue loop list dynamic data processing methods introduced to you this time. Thank you for your support.