How does vue.js dynamically add input boxes and buttons to trigger events bound by dynamically added buttons?

how to dynamically add input boxes and buttons to trigger events bound by dynamically added buttons? Ask the master for help, thank you! The
code is as follows:

<template>
    <div>
        <Form
            :label-width="120"
            label-position="right"
        >
            <FormItem label=":">
                <div
                    v-html="item"
                    v-for="(item,index) in list"
                >
                    {{item}}
                </div>
            </FormItem>
        </Form>
    </div>
</template>
</FormItem>
<script lang="ts">
import { CreateElement } from "vue";
import { Vue, Component, Watch } from "vue-property-decorator";
import Axios, { AxiosResponse, AxiosError } from "axios";
import VueRouter from "vue-router";
import moment from "moment";
import _ from "lodash";
@Component
export default class Page extends Vue {

  list: any = [
    "<Input v-model="inputParams" placeholder="" style="width: 800px;"></Input>
    <Button type="info" style="margin-left:10px;"  v-on:click="addParams"></Button>"
  ];
  html = "";
  addParams() {
    this.list.push(
      "<br/><Input v-model="inputParams" placeholder=""  style="width: 800px;"></Input>
      <Button type="info" style="margin-left:10px;" @click.sync="remove($event)"></Button>"
    );
  }
</script>

because you don"t understand what I"m trying to say, I put the picture up so that you can see a little

.

clipboard.png
Click add parameters, and you will dynamically add a text box and a delete button. Now I don"t know how to dynamically bind an event to the deletion.
some people on the
network say to use v-on:click, and some say to use @ click.sync to trigger the deletion event. Thank you!

Jul.13,2022

bind a custom attribute to the delete button each time the dom is dynamically generated, which is data-related and unique.

any kind of deletion event can be triggered. After binding, the custom attribute is passed in. When processing the data, you can find the data through this custom attribute, delete it, and delete the corresponding dom

.

to be honest, I don't quite understand your code. You encapsulate the two buttons into components, and then you want to distinguish which button is when you use it. For example, if there are many "add" buttons in a list, you should pass parameters to this click event (for example, pass an ID), indicating that he is the number of buttons


parent. What do you mean by dynamic binding event? Does it mean that each delete button binds a different event, or that each delete button is bound to an event?


here the delete button and the input box should be in the same component. Click add in the parent component. Click Delete from the component can trigger the parent component event to delete


I finally understand what to do, thank you for your attention!

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