-
Notifications
You must be signed in to change notification settings - Fork 305
[Cascader] Cascader 无法使用懒加载,在现有demo 下如何实现lazy #2747
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
Labels
demo
示例
Comments
👋 @synctimes163,感谢给 TDesign 提出了 issue。 |
好了吗 |
This was referenced Mar 18, 2025
Closed
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);
}
> }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这个功能解决了什么问题
[Cascader] Cascader 无法使用懒加载,在现有demo 下如何实现lazy
你建议的方案是什么
在现有demo 下实现lazy,提供demo
The text was updated successfully, but these errors were encountered: