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

[Bug Report] cascader 默认赋值问题 #12830

Open
chrisworkalx opened this issue Apr 25, 2024 · 0 comments
Open

[Bug Report] cascader 默认赋值问题 #12830

chrisworkalx opened this issue Apr 25, 2024 · 0 comments

Comments

@chrisworkalx
Copy link

Reproduction Link

https://codepen.io/chrisworkalx/pen/mdgvYoG

Vant Version

"vant": "^4.7.2"

Describe the Bug

  1. van-cascader组件 默认赋值匹配失败

Reproduce Steps

<template>
  <van-cascader
    v-model="code"
    title="请选择"
    :options="options"
  />
</template>

<script setup>

import {
ref
} from 'vue';

const code = ref('1');

 const options = [
      {
        text: '浙江省',
        value: '20',
        children: [{ text: '杭州市', value: '1', children:  [{ text: 'A区', value: '1'}]}],
      },
      {
        text: '江苏省',
        value: '30',
        children: [{ text: '南京市', value: '1', children: [{ text: 'B区', value: '1'}], }],
      },
    ];
</script>

issue: 如果这样默认值赋值,会造成匹配失败,请问这个该如何解决?

Device / Browser

No response

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

No branches or pull requests

1 participant