How does the vue child component manipulate the data of the parent component?

each click, let the value of the corresponding age of + 1 come from the data of the parent component. Should the operation of + 1 be written in the child component or in the parent component (can the operation of + 1 not be written in the tag and written in the parent component or child component?)

<!DOCTYPE html>
<html>
<head>
   <title></title>
   <style type="text/css">
   li{display: inline-block;border: 1px solid black;width: 100px}
   </style>
   <script src="vue.js"></script>
   <script type="text/javascript">
      window.onload=function(){
         var contents={
             template:"-sharpcontents",
             props:["age"],
             data(){
                  return {
                     arr:[
                        {name:"zhangsan"},
                        {name:"lisi"},
                        {name:"wangwu"},
                     ]
                  }
             },
             methods:{
                change(num){
                     return numPP; //
                }
             }
         }
         new Vue({
               el:"-sharpdiv1",
               data:{
                arr2:[43,55,20],
               },
               components:{
                  "contents":contents
               },
               
         })
      }
   </script>
</head>
<body>
<template id="contents">
   <div>
        <ul>
          <li v-for="(item,index) in arr" @click=change(age[index])>{{item.name}}{{age[index]}}</li>
        </ul>
   </div>
</template>

<div id="div1">
    <contents :age="arr2"></contents>
</div>
</body>
</html>
Mar.26,2021

although it is not recommended to modify the data of the parent component directly in the child component, your requirement is quite simple to implement
1.

<li v-for="(item,index) in arr" @click=change(age[index])>{{item.name}}{{age[index]}}</li>
Change

to

<li v-for="(item,index) in arr" @click=change(index)>{{item.name}}{{age[index]}}</li>

2.

change(num){
    return numPP; //
}
Change

to

change(index) {
  this.age.splice(index, 1, this.age[index] + 1)
}

first of all, there is something wrong with the way your data is stored. Information belonging to the same object should not be placed separately. You can do so

[
    {
        name: 'zhangsan',
        age: 43
    }
]

so simply put the array in parent , and you can write

in this way through the click event passed to the
child component by props .
<li v-for="(item,index) in arr" @click="$emit('change',index)")>{{item.name}}{{item.age}}</li>

corresponding to receive from the parent component

<contents :arr="arr" @change="handleChange"></contents>

at this point, handleChange will accept index, for arr [index] .agePP

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35b80-2bf9b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35b80-2bf9b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?