How to click a button in vue to dynamically add multiple div, and add double-click events or right-click events to these div

the environmental background of the problems and what methods you have tried

here is my own div. generated with js Please tell me how to use vue

.

related codes

<div class="resize-container" ref="resize" id="resize" v-html="items">
</div>
addDiv(){
    this.floorNumber PP;
    var div = document.createElement("div");
    div.id ="div"+this.floorNumber;
    div.setAttribute("class", "resize-drag");
    div.style.cssText="width:80px;height:50px;border:1px solid -sharp000;";
            // this.$refs.resize.appendChild(div);
            // div.ondblclick = this.objclick();
},

what result do you expect? What is the error message actually seen?

you want to add div, and attach events. Events cannot be triggered after using v-html

Apr.09,2021

use the v-for loop to add an element to the array when you click the button

<div v-for="(item,index) in arr" :id="`dev${index}`" class="resize-drag" @click="objclick"></div>

you can try another method. Create an Vue instance implicitly, which is more suitable for encapsulating it into a function to call

.
  

upstairs is right. I've tried it. Just click on the event and add it to your button.

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-1eaf89e-46ce3.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-1eaf89e-46ce3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?