youzan / vant

A lightweight, customizable Vue UI library for mobile web apps.

Home Page:https://vant-ui.github.io/vant/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug Report] cascader 默认赋值问题

chrisworkalx opened this issue · 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