Skip to content

fix(cascader): 修复cascader支持lazy #3535

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

Closed
wants to merge 1 commit into from

Conversation

liuffff
Copy link
Collaborator

@liuffff liuffff commented Mar 19, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

修复#2747

💡 需求背景和解决方案

📝 更新日志

  • fix(组件名称): 处理问题或特性描述 ...

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@liuffff
Copy link
Collaborator Author

liuffff commented Mar 19, 2025

demo可以用以下示例
onPick(e) {
console.log(e.detail);
const { value, index } = e.detail;
const { options } = this.properties;
if (options[index] && value === options[index].value && options[index].children?.length === 0) {
Toast({
context: this,
selector: '#t-toast',
theme: 'loading',
message: '加载中...',
direction: 'column',
duration: 500,
preventScrollThrough: true,
});
// 模拟数据请求
setTimeout(() => {
options[0].children = [{ value: '110100', label: '北京市', children: [] }];
this.setData({
options,
});
hideToast({
context: this,
selector: '#t-toast',
});
}, 500);
} else if (
options[index]?.children[index] &&
value === options[index]?.children[index].value &&
options[index].children[index].children?.length === 0
) {
Toast({
context: this,
selector: '#t-toast',
theme: 'loading',
message: '加载中...',
direction: 'column',
duration: 500,
preventScrollThrough: true,
});
// 模拟数据请求
setTimeout(() => {
options[0].children[0].children = [
{ value: '110101', label: '东城区' },
{ value: '110102', label: '西城区' },
{ value: '110105', label: '朝阳区' },
{ value: '110106', label: '丰台区' },
{ value: '110107', label: '石景山区' },
{ value: '110108', label: '海淀区' },
{ value: '110109', label: '门头沟区' },
{ value: '110111', label: '房山区' },
{ value: '110112', label: '通州区' },
{ value: '110113', label: '顺义区' },
{ value: '110114', label: '昌平区' },
{ value: '110115', label: '大兴区' },
{ value: '110116', label: '怀柔区' },
{ value: '110117', label: '平谷区' },
{ value: '110118', label: '密云区' },
{ value: '110119', label: '延庆区' },
];
this.setData({
options,
});
hideToast({
context: this,
selector: '#t-toast',
});
}, 500);
}
},

Copy link

pkg-pr-new bot commented Mar 20, 2025

Open in Stackblitz

npm i https://pkg.pr.new/tdesign-miniprogram@3535

commit: 777469d

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

Successfully merging this pull request may close these issues.

1 participant