@code { private readonly List _item2 = new List(); private IEnumerable Items2 => _item2; ///
/// 获得 默认数据集合 ///
private readonly IEnumerable Items3 = new SelectedItem[] { new SelectedItem ("", "请选择 ..."), new SelectedItem ("Beijing", "北京"), new SelectedItem ("Shanghai", "上海"), new SelectedItem ("Hangzhou", "杭州") }; private Select Select2; ///
/// 级联绑定菜单 ///
/// protected void OnCascadeBindSelectClick(SelectedItem item) { _item2.Clear(); if (item.Value == "Beijing") { _item2.AddRange(new SelectedItem[] { new SelectedItem("1","朝阳区"), new SelectedItem("2","海淀区"), }); } else if (item.Value == "Shanghai") { _item2.AddRange(new SelectedItem[] { new SelectedItem("1","静安区"), new SelectedItem("2","黄浦区"), }); } Select2?.SetItems(_item2); return Task.CompletedTask; } }