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

Picker 组件会默认设置columns的第一个,应该根据modelValue设置默认值 #3170

Open
wiiyee opened this issue Aug 14, 2024 · 0 comments

Comments

@wiiyee
Copy link

wiiyee commented Aug 14, 2024

NutUI 包名

@nutui/nutui

NutUI 版本号

4.3.12

平台

h5

重现链接

https://nutui.jd.com/h5/vue/4x/#/zh-CN/component/picker

重现步骤

默认选中项
通过设置 v-model 实现默认选中项,v-model 是一个包含每项配置 value 值的数组。

<nut-picker v-model="val" :columns="columns" :title="String(val)" @confirm="confirm" />

<script setup> import { ref } from 'vue' const val = ref() const columns = ref([ { text: '南京', value: 'Nanjing' }, { text: '无锡', value: 'Wuxi' }, { text: '海北', value: 'Haibei' }, { text: '北京', value: 'Beijing' }, { text: '连云港', value: 'Lianyungang' }, { text: '长沙', value: 'Changsha' }, { text: '武汉', value: 'Wuhan' } ]) const confirm = ({ selectedValue, selectedOptions }) => { console.log(selectedValue[0], selectedOptions[0]) } </script>

期望的结果是什么?

没有设置默认值应该不选中

实际的结果是什么?

默认选中了第一个

环境信息

No response

其他补充信息

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant