element [bug report] when the data bound by El select v-mode is different from the data in the El options list, select the last item in the list to be selected twice

ctehm74n  于 2023-02-04  发布在  其他
关注(0)|答案(2)|浏览(192)

Element UI version

2.13.2

OS/Browsers version

win10 x64 版本号:20H2, 操作系统版本:19042.685

Vue version

2.6.10

https://elementui.github.io/

Steps to reproduce

先吐槽一下,话说提bug的时候,要重现链接必填,是不想让人提bug吗?
项目在开发中,还没有上线,没有重现链接

在编辑记录场景下,用el-select 多选,v-mode 绑定原有的选中记录(数组,2个元素),el-option 待选择列表里面的值,和原有的值不匹配, 此时会报把待选择列表当中的最后一项,选中2次
我觉得这是个bug

以下是代码解释, 这个很好测试,你们直接 生成两个数据结构完全相同,但是数据完全不相同的数组 试一下就知道了

formItems.resourcesProject.projectList和projectList 数据【结构】完全相同,但是数据完全不相同,最终会把 projectList里面的最后一项值,选择2次,这是个bug

<el-col :span="24" v-if="formItems.resourcesProject">
        <el-form-item label="所属项目:">
          <el-select v-model="formItems.resourcesProject.projectList" no-match-text="test" multiple placeholder="请选择所属项目">
            <el-option
              v-for="item in projectList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>

What is Expected?

在编辑场景下,原有的选中的值和待选择列表 没有匹配到的话,不显示才对

What is actually happening?

在编辑场景下,原有的选中的值和待选择列表 两个【数据结构】【完全相同】, 数据完全【不相同】, 会把待选择列表当中的最后项选了两次,这导致报:重复的key这样的错,
“[Vue warn]: Duplicate keys detected: '1001'. This may cause an update error.”

q9yhzks0

q9yhzks01#

Translation of this issue:

Element UI version

2.13.2

OS/Browsers version

Win10 x64 version number: 20h2, operating system version: 19042.685

Vue version

2.6.10

https://elementui.github.io/

Steps to reproduce

First, when you talk about bug, you need to repeat links. Do you want to make complaints about bug?

The project is under development, it has not been launched, and there is no recurrence link
In the editing record scenario, use El select to select multiple items and v-mode to bind the original selected records (array, 2 elements). The value in the list to be selected by El option does not match the original value. In this case, the last item in the list to be selected will be selected twice

I think it's a bug
The following is a bug. This is a good test. You can directly generate two arrays that are completely different from each other

formItems.resourcesProject.projectList It is exactly the same as the data [structure] of the projectlist, but the data is completely different. Finally, the value of the last item in the projectlist will be selected twice. This is a bug
<el-col :span="24" v-if=" formItems.resourcesProject >

< El form item label = item: >
<el-select v-model=" formItems.resourcesProject.projectList "No match text = test" multiple holder: "please select the item" > "

<el-option
v-for="item in projectList"

:key=" item.id "
:label=" item.name "

:value=" item.id >

What is Expected?

In the editing scenario, if the original selected value does not match the list to be selected, it will not be displayed

What is actually happening?

In the editing scenario, the data structure of the original selected value and the list to be selected are identical, and the data is completely different. The last item in the list to be selected is selected twice, resulting in the error of duplicate key,
“[Vue warn]: Duplicate keys detected: '1001'. This may cause an update error.”

iqxoj9l9

iqxoj9l92#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题