Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoComplete组件参数options的value属性不起作用 #5794

Closed
5 tasks done
myrelease opened this issue Mar 19, 2024 · 1 comment · May be fixed by #5797
Closed
5 tasks done

AutoComplete组件参数options的value属性不起作用 #5794

myrelease opened this issue Mar 19, 2024 · 1 comment · May be fixed by #5797
Labels
untriaged need to sort

Comments

@myrelease
Copy link

描述错误

AutoComplete组件参数options的value属性不起作用
例如,对该组件设置options参数如下

[ { label: "a", value: "b"}]

选中该选项后,赋值的是label的值a,而不是b

复现步骤

访问链接查看实例 https://stackblitz.com/edit/vitejs-vite-rsps4c?file=src%2FApp.vue
options中value属性不生效,还是使用label值来赋值

<template>
  value:{{ value }}
  <br />
  <br />
  <br />
  <n-auto-complete
    v-model:value="value"
    :input-props="{
      autocomplete: 'disabled',
    }"
    :options="options"
    placeholder="邮箱"
    clearable
  />
</template>

<script lang="ts">
import { defineComponent, ref, computed } from 'vue';
import { NAutoComplete } from 'naive-ui';
export default defineComponent({
  components: {
    NAutoComplete,
  },
  setup() {
    const valueRef = ref('');
    return {
      value: valueRef,
      options: computed(() => {
        return ['@gmail.com', '@163.com', '@qq.com'].map((suffix) => {
          const prefix = valueRef.value.split('@')[0];
          return {
            label: prefix + suffix + '__label',
            value: prefix + suffix + '__value',
          };
        });
      }),
    };
  },
});
</script>

最小复现链接

https://stackblitz.com/edit/vitejs-vite-rsps4c?file=src%2FApp.vue

系统信息

stackblitz.com 平台信息
System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    naive-ui: ^2.38.1 => 2.38.1 
    vue: ^3.4.21 => 3.4.21

使用的包管理器

npm

验证

@myrelease myrelease added the untriaged need to sort label Mar 19, 2024
jizai1125 added a commit to jizai1125/naive-ui that referenced this issue Mar 20, 2024
jizai1125 added a commit to jizai1125/naive-ui that referenced this issue Mar 20, 2024
jizai1125 added a commit to jizai1125/naive-ui that referenced this issue Mar 22, 2024
@myrelease
Copy link
Author

myrelease commented Mar 24, 2024

什么时候能发布新版本修复这个bug呢?

@myrelease myrelease closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant