vant icon indicating copy to clipboard operation
vant copied to clipboard

[Bug Report] cascader 默认赋值问题

Open chrisworkalx opened this issue 9 months ago • 0 comments

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

chrisworkalx avatar Apr 25 '24 10:04 chrisworkalx