فهرست منبع

ModeSwitch 添加 channel

visuddhinanda 2 سال پیش
والد
کامیت
8e4bb93f17
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      dashboard/src/pages/library/article/show.tsx

+ 14 - 0
dashboard/src/pages/library/article/show.tsx

@@ -81,6 +81,7 @@ const Widget = () => {
           <div></div>
           <div key="right" style={{ display: "flex" }}>
             <ModeSwitch
+              channel={searchParams.get("channel")}
               currMode={currMode}
               onModeChange={(e: ArticleMode) => {
                 let output: any = { mode: e };
@@ -92,6 +93,19 @@ const Widget = () => {
                 });
                 setSearchParams(output);
               }}
+              onChannelChange={(channels: IChannel[], mode: ArticleMode) => {
+                let output: any = {
+                  mode: mode,
+                  channel: channels.map((item) => item.id).join("_"),
+                };
+                searchParams.forEach((value, key) => {
+                  console.log(value, key);
+                  if (key !== "mode" && key !== "channel") {
+                    output[key] = value;
+                  }
+                });
+                setSearchParams(output);
+              }}
             />
             <Divider type="vertical" />
             <RightToolsSwitch