除了最后一个标签点击关闭外 点击关闭会关掉两个tag
之前的代码:
<template v-for="(tag,index) in tags">
<a-tag
:key="index"
:color="tag.ftagcolor"
closable
@close="() => handleClose(tag)"
style="margin-right:8px;margin-bottom:8px">
{{ tag.ftagname }}
</a-tag>
</template>
关键就是key
修改后的代码:
<template v-for="tag in tags">
<a-tag
:key="tag.ftagname"
:color="tag.ftagcolor"
closable
@close="() => handleClose(tag)"
style="margin-right:8px;margin-bottom:8px">
{{ tag.ftagname }}
</a-tag>
</template>