IDuxFE/idux

[ pro-search] [偶现] 快捷面板下配置keywordFallback,一键清空,删除等操作后,输入关键字,默认选中的项不对

ljf52007 opened this issue · 1 comments

问题:快捷面板下配置keywordFallback,一键清空,删除等操作后,输入关键字,默认选中的项不对

复现链接:playground.idux.site
复现demo:

<template>
  <div style="padding: 24px">
    <IxProSearch
                 class="pull-right"
                 style="width: 80%"
                 :value.sync="filterValue"
                 :searchFields="searchFields"
                 overlay-container='pro-search-wrapper--loophole'>
    </IxProSearch>
  </div>
</template>
 

<script setup lang="ts">
  import {ref, computed} from 'vue'
 
const filterValue = ref<SearchValue[]>([]);
  const searchFields = computed<SearchField[]>(() => [
    {
        type: 'select',
        label: '终端类型',
        key: 'host_type',
        quickSelect: true,
        placeholder: '终端类型',
        fieldConfig: {
            multiple: false,
            searchable: true,
            dataSource: [
              { label: '全部', key: 1},
              { label: 'PC', key:0},
              { label: '服务器', key:3},
          ]
        }
    },
     {
        type: 'input',
        label: '关键字1',
        key: 'xixi',
       keywordFallback: true,
        placeholder: '终端类型',
    },
         {
        type: 'input',
        label: '关键字2',
        key: 'haha',
       keywordFallback: true,
        placeholder: '终端类型',
    },

]);
const searchKeys = computed(() => searchFields.value.map(i => i.key as string));
const filterFields = (fields: SearchField[], keys: string[]) => {
  return fields.filter(field => keys.includes(field.key as string))
}
</script>

复现步骤:

  1. 第一次输入关键字,回车;
  2. 一键清除;
  3. 第二次输入关键字,回车;

期望结果:
默认选中的应该还是第一项;

实际结果:
默认选中第二项;

(可能是multiple引发,重新打开没有重置)

Hello @ljf52007, your issue has been closed because it does not conform to our issue requirements.
Please use the issue template to create an issue, thank you!

你好 @ljf52007,为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。
你可以通过 issue 模板来创建 issue 以方便我们定位错误。谢谢配合!