Vue Loop to create id splicing Index

< div VFF = "(data,index) in arr" >

)
<canvas :id="mycanvas(index)" width="140" height="140"></canvas>

< / div >

create canvas in a loop but report _ vm.mycanvas is not a function

it"s no problem to use normal div without canvas tags

Jan.10,2022

you are prompted that the mycanvas function is missing. There are two ways to concatenate strings

the first type

 methods:{
     mycanvas(index){
       return "canvas_" +index
    }
  }

the second type

<canvas v-for="(data,index) in arr" :id="['canvas'+index]">

mycanvas is written in computed , but it will be fine if you write it in methods .

methods: {
    mycanvas (index) {
      return 'item' + index
    }
 }
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-1e98cea-1706.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-1e98cea-1706.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?