Skip to content

[Cascader级联选择器] options只能静态数据,不支持响应式ref #2011

@chenshiming1113

Description

@chenshiming1113

tdesign-mobile-vue 版本

1.10.0

重现链接

No response

重现步骤

const departmentOptions = ref([])
onMounted(() => {
// 加载部门数据
fetchTreeData().then((res) => {
departmentOptions.value = res.data? || []
})
})
<t-cascader
style="padding: 10px; background: #f8f8f8"
title="选择部门"
v-model:visible="departmentVisible"
v-model="departmentId"
:options="departmentOptions"
:keys="{ value: 'id', label: 'name', children: 'children' }"
@change="handleDepartmentChange"
/>

期望结果

显示部门数据

实际结果

没有响应式,部门显示是空,如果直接const departmentOptions = ref([静态数据]),可以显示部门数据。之前1.8.3版本是可以的。

框架版本

Vue(3.5)

浏览器版本

No response

系统版本

No response

Node版本

22

补充说明

之前1.8.3版本是可以的。升级到1.10就不行了

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions