Skip to content

t-picker keys属性 动态设置无效 #4081

@JinBoss

Description

@JinBoss

tdesign-miniprogram 版本

1.11.1

重现链接

No response

重现步骤

picker_value: 0,
picker_title: '',
picker_key: {},
picker_type: 0,
picker_data: [],
picker_visible: false,

politics_list: [
{
"title": "党员",
"id": 1
},
{
"title": "团员",
"id": 2
},
{
"title": "民主人士",
"id": 3
},
{
"title": "群众",
"id": 4
}
],
education_list: [
{
"id": 1,
"code_name": "博士研究生"
},
{
"id": 2,
"code_name": "硕士研究生"
},
{
"id": 3,
"code_name": "研究生班"
},
{
"id": 4,
"code_name": "大学本科"
},
{
"id": 5,
"code_name": "大学专科"
},
{
"id": 6,
"code_name": "中等专科"
},
{
"id": 7,
"code_name": "普通高中"
},
{
"id": 8,
"code_name": "初级中学"
},
{
"id": 9,
"code_name": "小学"
},
{
"id": 10,
"code_name": "其他"
}
]

onPickerShow(e) {
console.log(e)
const type = e.currentTarget.dataset.type;
let list = []
let picker_key = {value: 'id', label: 'title'};
let title = '';
let picker_value = 0;
if (type === 1) {
title = '请选择学历'
picker_key = {value: 'id', label: 'code_name'};
list = this.data.nation_list;
picker_value = this.data.member.nationality
} else if (type === 2) {
title = '请选择政治面貌'
picker_key = {value: 'id', label: 'title'};
list = this.data.politics_list;
picker_value = this.data.member.politics
}
console.log('type', type, list, picker_key);
this.setData({
picker_title: title,
picker_key: picker_key,
picker_type: type,
picker_data: list,
picker_visible: true,
})
},


民族


政治面貌

期望结果

No response

实际结果

No response

基础库版本

3.11.1

补充说明

No response

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