[Blazor] Blazor를 이용하여 accordion 만들기
😬 Blazor를 이용하여 accordion 만들기
// String 으로 넘어온 메뉴리스트(json 형태)를 변환한다.
// Newtonsoft.Json 라이브러리를 사용 https://www.newtonsoft.com/json
var menuObj = JsonConvert.DeserializeObject<List<MenuData>>(reply.JsonString);
<MainMenuComponent menuObjParam="@menuObj" />
//메뉴 데이터가 Parameter로 넘어온다.
[AllowNull]
[Parameter] public IEnumerable<MenuData> menuObjParam { get; set; }
//메뉴가 없을때 처리
private string textEmpty = "해당메뉴 확인요망!!!!!!!!!!";
//중메뉴 Index
int bindIndex;
//대메뉴 클릭시 움직이는 이벤트
void ChangeItem(int index) => bindIndex = index;
완성!!!!!
Note: 만들고나니 내것이 아니었다.
Leave a comment