{"id":604,"date":"2024-01-28T22:26:40","date_gmt":"2024-01-29T06:26:40","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/?p=604"},"modified":"2024-05-16T18:21:28","modified_gmt":"2024-05-17T01:21:28","slug":"%e4%bd%bf%e7%94%a8-sortablejs-%e7%bb%84%e4%bb%b6%e7%9a%84-blazor-%e5%8f%af%e6%8e%92%e5%ba%8f%e5%88%97%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/%e4%bd%bf%e7%94%a8-sortablejs-%e7%bb%84%e4%bb%b6%e7%9a%84-blazor-%e5%8f%af%e6%8e%92%e5%ba%8f%e5%88%97%e8%a1%a8\/","title":{"rendered":"\u4f7f\u7528 SortableJS \u7ec4\u4ef6\u7684 Blazor \u53ef\u6392\u5e8f\u5217\u8868\u00a0"},"content":{"rendered":"<p style=\"text-align: center;\"><em>\u672c\u7bc7\u7ffb\u8bd1\u4e8eBurke Holland\u7684<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-blazor-sortable\/\">Sortable Lists for Blazor using a SortableJS Component <\/a>\u00a0<\/em><\/p>\n<p><span data-contrast=\"auto\">\u5728<\/span><span data-contrast=\"auto\">Web <\/span><span data-contrast=\"auto\">\u5e94\u7528\u7a0b\u5e8f\u4e2d<\/span><span data-contrast=\"auto\">\uff0c<\/span><span data-contrast=\"auto\">\u4e00\u4e2a\u5e38\u89c1\u529f\u80fd\u90e8\u5206\u662f\u53ef\u6392\u5e8f\u5217\u8868\u3002<\/span><a href=\"https:\/\/github.com\/SortableJS\/Sortable\"><span data-contrast=\"none\">SortableJS<\/span><\/a><span data-contrast=\"auto\">\u662f\u6211\u6700\u559c\u6b22\u7684<\/span><span data-contrast=\"auto\"> JavaScript <\/span><span data-contrast=\"auto\">\u5e93\u4e4b\u4e00\uff0c\u5728\u8fdb\u884c<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u5f00\u53d1\u65f6\u6211\u5f88\u60f3\u5ff5\u5b83\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u51b3\u5b9a\u5305\u88c5<\/span><span data-contrast=\"auto\"> SortableJS <\/span><span data-contrast=\"auto\">\u5e93\uff0c\u4f7f\u5176\u6210\u4e3a<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u7ec4\u4ef6\uff0c\u540d\u4e3a<\/span><span data-contrast=\"auto\">B<\/span><a href=\"https:\/\/blazorsortable.theurlist.com\/\"><span data-contrast=\"none\">azor Sortable<\/span><\/a><span data-contrast=\"auto\">\uff0c\u6211\u5df2\u5728<\/span><span data-contrast=\"auto\"> GitHub <\/span><span data-contrast=\"auto\">\u4e0a\u5f00\u6e90\u4e86\u5b83\uff0c\u6211\u76f8\u4fe1\u60a8\u4f1a\u559c\u6b22\u5b83\u7684\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5f15\u5bfc\u60a8\u4e86\u89e3\u5982\u4f55\u5c06\u5176\u6dfb\u52a0\u5230\u60a8\u81ea\u5df1\u7684<\/span><span data-contrast=\"auto\"> Blazor Web <\/span><span data-contrast=\"auto\">\u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<blockquote><p><span data-contrast=\"auto\">\u6ce8\u610f\uff1a<\/span><span data-contrast=\"auto\">Blazor Sortable <\/span><span data-contrast=\"auto\">\u662f\u4e00\u4e2a\u5f00\u6e90\u793e\u533a\u7ec4\u4ef6\uff0c\u800c\u4e0d\u662f<\/span><span data-contrast=\"auto\"> Microsoft <\/span><span data-contrast=\"auto\">\u7684\u5b98\u65b9\u7ec4\u4ef6\u3002<\/span><span data-contrast=\"auto\">Blazor<\/span><span data-contrast=\"auto\">\u7684<\/span><span data-contrast=\"auto\"> Fluent UI<\/span><span data-contrast=\"auto\">\u56e2\u961f\u6b63\u5728\u81f4\u529b\u4e8e\u5728\u5373\u5c06\u53d1\u5e03\u7684<\/span><span data-contrast=\"auto\"> Blazor<\/span><span data-contrast=\"auto\">\u7684<\/span><span data-contrast=\"auto\">Fluent UI <\/span><span data-contrast=\"auto\">\u7248\u672c\u4e2d\u96c6\u6210\u53ef\u6392\u5e8f\u7ec4\u4ef6\u3002\u60a8\u73b0\u5728\u53ef\u4ee5\u5c1d\u8bd5<\/span><span data-contrast=\"auto\">Fluent UI Sortable Demo\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559685&quot;:420}\">\u00a0<\/span><\/p><\/blockquote>\n<p><span data-contrast=\"auto\">\u8bf7\u5728\u8fd9\u91cc\u67e5\u770b\u6f14\u793a\uff1a<\/span> <a href=\"https:\/\/blazorsortable.theurlist.com\/\"><span data-contrast=\"none\">https: \/\/blazorsortable.theurlist.com<\/span><\/a><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\"> <img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-blazor-sortable\/simple-list.gif\" alt=\"A screenshot of the blazor sortable demos\" \/><\/span><\/p>\n<p><span data-contrast=\"auto\">\u6bcf\u5468\u4e94<\/span><span data-contrast=\"auto\">\uff0c<\/span><a href=\"https:\/\/twitter.com\/jongalloway\"><span data-contrast=\"none\">Jon Galloway<\/span><\/a><span data-contrast=\"auto\">\uff08<\/span><span data-contrast=\"auto\">\u867d\u7136\u4f60\u53ef\u80fd\u4ece\u672a\u542c\u8bf4\u8fc7\u4ed6\uff0c\u4f46\u4ed6\u503c\u5f97\u4fe1\u8d56\uff09\u548c\u6211\u81f4\u529b\u4e8e\u5728<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u4e2d\u91cd\u5efa\u4e00\u4e2a\u540d\u4e3a<\/span><a href=\"https:\/\/theurlist.com\/\"><span data-contrast=\"none\">theurlist.com<\/span><\/a><span data-contrast=\"auto\">\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u8be5\u76f4\u64ad\u5728<\/span><span data-contrast=\"auto\"> Twitch <\/span><span data-contrast=\"auto\">\u548c<\/span><span data-contrast=\"auto\"> .NET YouTube <\/span><span data-contrast=\"auto\">\u4e0a\u88ab\u79f0\u4e3a<\/span><span data-contrast=\"auto\">\u201c <\/span><a href=\"https:\/\/dotnet.microsoft.com\/live\/burke-learns-blazor\"><span data-contrast=\"none\">Burke Learns Blazor<\/span><\/a><span data-contrast=\"auto\"> \u201d\uff08<\/span><a href=\"https:\/\/www.youtube.com\/@dotnet\/\"><span data-contrast=\"none\">\u70b9\u8d5e\u5e76\u8ba2\u9605<\/span><\/a><span data-contrast=\"auto\">\uff01\uff09\u3002<\/span><span data-contrast=\"auto\">\u5982\u679c\u60a8\u613f\u610f\u52a0\u5165\u6211\u4eec\uff0c\u6211\u4eec\u5c06\u4f1a\u975e\u5e38\u9ad8\u5174<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-contrast=\"auto\">\u7531\u4e8e\u6211\u4e0d\u77e5\u9053\u6211\u4eec\u73b0\u5728\u9700\u8981\u505a\u4e9b\u4ec0\u4e48\uff0c\u6240\u6709\u6211\u4eec\u9700\u8981\u5c3d\u53ef\u80fd\u591a\u7684\u5e2e\u52a9\u6765\u4e00\u8d77\u5904\u7406\u8fd9\u4ef6\u4e8b<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u6211\u4eec\u6700\u7ec8\u9700\u8981\u4e00\u4e2a\u53ef\u6392\u5e8f\u5217\u8868\u7ec4\u4ef6\u6765\u8fdb\u884c\u6b64\u91cd\u5efa\uff0c\u867d\u7136\u6709\u4e00\u4e9b<\/span><span data-contrast=\"auto\">\u201cBlazor Sortable\u201d<\/span><span data-contrast=\"auto\">\u793a\u4f8b\uff0c\u4f46\u6211\u8fd8\u662f\u5f88\u60f3\u8981\u7528<\/span><span data-contrast=\"auto\">SortableJS\u3002<\/span><a href=\"https:\/\/github.com\/SortableJS\/Sortable\"><span data-contrast=\"none\">SortableJS<\/span><\/a> <span data-contrast=\"auto\">\u662f\u4e00\u4e2a\u51fa\u8272\u7684\u5e93\uff0c\u7528\u4e8e\u6784\u5efa\u53ef\u6392\u5e8f\u7684\u9879\u76ee\u5217\u8868\uff0c\u51e0\u4e4e\u5177\u6709\u60a8\u53ef\u80fd\u9700\u8981\u7684\u6240\u6709\u529f\u80fd<\/span><span data-contrast=\"auto\"> &#8211; <\/span><span data-contrast=\"auto\">\u6392\u5e8f\u3001\u5217\u8868\u4e4b\u95f4\u7684\u6392\u5e8f\u3001\u514b\u9686\u9879\u76ee\u3001\u8fc7\u6ee4\u3001\u81ea\u5b9a\u4e49\u52a8\u753b\u7f13\u52a8\u3001\u8170\u90e8\u652f\u6301\u3002\u597d\u5427<\/span><span data-contrast=\"auto\">\u2014\u2014<\/span><span data-contrast=\"auto\">\u6700\u540e\u4e00\u4e2a\u4e0d\u662f\uff0c\u4f46\u8fd9\u662f\u5b83\u552f\u4e00\u6ca1\u6709\u7684\u4e1c\u897f\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u56e0\u6b64\uff0c\u5728<\/span><span data-contrast=\"auto\"> Steve Sanderson <\/span><span data-contrast=\"auto\">\u7684\u5e2e\u52a9\u4e0b\uff0c\u6211\u4eec\u5728<\/span><span data-contrast=\"auto\"> SortableJS <\/span><span data-contrast=\"auto\">\u4e0a\u6784\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u62bd\u8c61\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u653e\u5165\u60a8\u81ea\u5df1\u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5e76\u4f7f\u7528\u3002<\/span> <span data-contrast=\"auto\">\u8ba9\u6211\u4eec\u770b\u4e00\u4e0b\u5982\u4f55\u4e3a\u60a8\u81ea\u5df1\u7684<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u548c\u81ea\u5b9a\u4e49<\/span><span data-contrast=\"auto\"> Blazor Sortable\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">\u4f7f\u7528<\/span><\/b><b><span data-contrast=\"auto\"> Blazor Sortable<\/span><\/b><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">Blazor Sortable <\/span><span data-contrast=\"auto\">\u7684<\/span><span data-contrast=\"auto\"> GitHub <\/span><span data-contrast=\"auto\">\u5b58\u50a8\u5e93\u5305\u542b\u53ef\u6392\u5e8f\u5217\u8868\u7684\u6e90\u4ee3\u7801\u4ee5\u53ca\u6f14\u793a\u3002\u5bf9\u4e8e\u60a8\u81ea\u5df1\u7684\u9879\u76ee\uff0c\u60a8\u53ea\u9700\u8981<\/span><span data-contrast=\"auto\"><span style=\"color: #ff0000;\"> Shared\/SortableList.razor<\/span>\u3001<span style=\"color: #ff0000;\">Shared\/SortableList.razor.css<\/span> <\/span><span data-contrast=\"auto\">\u548c<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> Shared\/SortableList.razor.js <\/span><span data-contrast=\"auto\">\u6587\u4ef6<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-blazor-sortable\/sortable-components.png\" alt=\"a screenshot of the files needed for Blazor Sortable in GitHub\" \/><\/p>\n<p><span style=\"color: #ff0000;\" data-contrast=\"auto\">SortableList <\/span><span data-contrast=\"auto\">\u7ec4\u4ef6\u662f\u4e00\u4e2a\u901a\u7528\u7ec4\u4ef6\uff0c\u5b83\u91c7\u7528\u9879\u76ee\u5217\u8868\u548c\u5b9a\u4e49\u5982\u4f55\u5448\u73b0\u53ef\u6392\u5e8f\u5217\u8868\u4e2d\u6bcf\u4e2a\u9879\u76ee\u7684<\/span><span data-contrast=\"auto\"><span style=\"color: #ff0000;\"> SortableItemTemplate<\/span>\u3002 <\/span><span data-contrast=\"auto\">\u4f8b\u5982\uff0c\u5047\u8bbe\u60a8\u6709\u4e00\u4e2a\u5982\u4e0b\u6240\u793a\u7684\u4e66\u7c4d\u5217\u8868<\/span><span data-contrast=\"auto\">&#8230;<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">public class Book\r\n{\r\n    public string Title { get; set; } = \"\";\r\n    public string Author { get; set; }  = \"\";\r\n    public int Year { get; set; }\r\n}\r\n\r\npublic List&lt;Book&gt; books = new List&lt;Book&gt;\r\n{\r\n    new Book { Title = \"The Very Hungry Caterpillar\", Author = \"Eric Carle\", Year = 1969 },\r\n    new Book { Title = \"Where the Wild Things Are\", Author = \"Maurice Sendak\", Year = 1963 },\r\n    new Book { Title = \"Goodnight Moon\", Author = \"Margaret Wise Brown\", Year = 1947 },\r\n    new Book { Title = \"The Cat in the Hat\", Author = \"Dr. Seuss\", Year = 1957 },\r\n    new Book { Title = \"Charlotte's Web\", Author = \"E.B. White\", Year = 1952 },\r\n    new Book { Title = \"Harry Potter and the Sorcerer's Stone\", Author = \"J.K. Rowling\", Year = 1997 },\r\n    new Book { Title = \"The Lion, the Witch and the Wardrobe\", Author = \"C.S. Lewis\", Year = 1950 },\r\n    new Book { Title = \"Matilda\", Author = \"Roald Dahl\", Year = 1988 },\r\n    new Book { Title = \"The Giving Tree\", Author = \"Shel Silverstein\", Year = 1964 },\r\n    new Book { Title = \"Oh, the Places You'll Go!\", Author = \"Dr. Seuss\", Year = 1990 }\r\n};<\/code><\/pre>\n<p><span data-contrast=\"auto\">\u60a8\u53ef\u4ee5\u5728<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList <\/span><span data-contrast=\"auto\">\u4e2d\u50cf\u4e0b\u9762\u8fd9\u6837\u5448\u73b0\u6b64\u5217\u8868<\/span><span data-contrast=\"auto\">&#8230;<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">&lt;div&gt;\r\n    &lt;SortableList Items=\"books\" Context=\"book\"&gt;\r\n        &lt;SortableItemTemplate&gt;\r\n            &lt;div class=\"book\"&gt;\r\n                &lt;p&gt;@book.Title&lt;\/p&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/SortableItemTemplate&gt;\r\n    &lt;\/SortableList&gt;\r\n&lt;\/div&gt;<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-blazor-sortable\/sortable-book-example.png\" alt=\"a screenshot of a sortable list of books\" \/><\/p>\n<p><span style=\"color: #ff0000;\" data-contrast=\"auto\">SortableList <\/span><span data-contrast=\"auto\">\u7ec4\u4ef6\u5c06\u4f7f\u7528<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableItemTemplate <\/span><span data-contrast=\"auto\">\u5448\u73b0\u9879\u76ee\u5217\u8868\uff0c\u7136\u540e\u4f7f\u7528<\/span><span data-contrast=\"auto\"> SortableJS <\/span><span data-contrast=\"auto\">\u4f7f\u5217\u8868\u53d8\u5f97\u53ef\u4ee5\u6392\u5e8f\u3002<\/span><span data-contrast=\"auto\"><span style=\"color: #ff0000;\">Context<\/span> <\/span><span data-contrast=\"auto\">\u53c2\u6570\u7528\u4e8e\u5b9a\u4e49\u53d8\u91cf\u7684\u540d\u79f0\uff0c\u8be5\u53d8\u91cf\u5c06\u7528\u4e8e\u8868\u793a\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u9879\u76ee\u3002<\/span> <span data-contrast=\"auto\">\u5728\u672c\u4f8b\u4e2d\uff0c<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\">Context<\/span><span data-contrast=\"auto\">\u662f<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> book<\/span><span data-contrast=\"auto\">\uff0c\u56e0\u6b64\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u9879\u76ee\u90fd\u5c06\u7531\u4e00\u4e2a\u540d\u4e3a<\/span><span data-contrast=\"auto\"><span style=\"color: #ff0000;\"> book<\/span> <\/span><span data-contrast=\"auto\">\u7684\u53d8\u91cf\u8868\u793a<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u4f46\u662f\uff0c\u5982\u679c\u60a8\u6b64\u65f6\u5c1d\u8bd5\u62d6\u653e\u9879\u76ee\uff0c\u60a8\u4f1a\u53d1\u73b0\u65e0\u8bba\u60a8\u600e\u4e48\u62d6\u653e\u4e00\u4e2a\u9879\u76ee\uff0c\u5b83\u90fd\u4f1a\u56de\u5230\u4e4b\u524d\u7684\u4f4d\u7f6e\u3002\u8fd9\u662f\u56e0\u4e3a\u6211\u4eec\u6ca1\u6709\u544a\u8bc9<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList <\/span><span data-contrast=\"auto\">\u5728\u5217\u8868\u6392\u5e8f\u65f6\u8be5\u505a\u4ec0\u4e48\u3002\u6211\u4eec\u901a\u8fc7\u5904\u7406<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> OnUpdate <\/span><span data-contrast=\"auto\">\u4e8b\u4ef6\u5e76\u81ea\u5df1\u8fdb\u884c\u6392\u5e8f\u6765\u505a\u5230\u8fd9\u4e00\u70b9<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">&lt;div&gt;\r\n    &lt;SortableList Items=\"books\" Context=\"book\" OnUpdate=\"@SortList\"&gt;\r\n        &lt;SortableItemTemplate&gt;\r\n            &lt;div class=\"book\"&gt;\r\n                &lt;p&gt;@book.Title&lt;\/p&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/SortableItemTemplate&gt;\r\n    &lt;\/SortableList&gt;\r\n&lt;\/div&gt;<\/code><\/pre>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">...\r\npublic void SortList((int oldIndex, int newIndex) indices)\r\n{\r\n    \/\/ deconstruct the tuple\r\n    var (oldIndex, newIndex) = indices;\r\n\r\n    var items = this.books;\r\n    var itemToMove = items[oldIndex];\r\n    items.RemoveAt(oldIndex);\r\n\r\n    if (newIndex &lt; items.Count)\r\n    {{\r\n        items.Insert(newIndex, itemToMove);\r\n    }}\r\n    else\r\n    {{\r\n        items.Add(itemToMove);\r\n    }}\r\n}<\/code><\/pre>\n<p><span data-contrast=\"auto\">\u6bcf\u5f53\u5217\u8868\u6392\u5e8f\u65f6\uff0c\u90fd\u4f1a\u8c03\u7528<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> OnUpdate <\/span><span data-contrast=\"auto\">\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u3002\u5b83\u5c06\u4f20\u9012\u4e00\u4e2a\u5305\u542b\u5df2\u79fb\u52a8\u9879\u76ee\u7684\u65e7\u7d22\u5f15\u548c\u65b0\u7d22\u5f15\u7684\u5143\u7ec4\u3002\u5728<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortList <\/span><span data-contrast=\"auto\">\u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u5c06\u5143\u7ec4\u89e3\u6784\u4e3a\u4e24\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u4f7f\u7528\u5b83\u4eec\u6765\u79fb\u52a8\u5217\u8868\u4e2d\u7684\u9879\u76ee<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u6c38\u8fdc\u4e0d\u8981\u6539\u53d8<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u63a7\u5236\u7684<\/span><span data-contrast=\"auto\"> DOM<\/span><span data-contrast=\"auto\">\uff0c\u8fd9\u4e00\u70b9\u975e\u5e38\u91cd\u8981\u3002<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u4fdd\u7559<\/span><span data-contrast=\"auto\"> DOM <\/span><span data-contrast=\"auto\">\u7684\u5185\u90e8\u526f\u672c\uff0c\u5982\u679c\u60a8\u4f7f\u7528<\/span><span data-contrast=\"auto\"> JavaScript <\/span><span data-contrast=\"auto\">\u7b49\u5185\u5bb9\u66f4\u6539\u5b83\uff0c\u60a8\u5c06\u5f97\u5230\u5947\u602a\u7684\u7ed3\u679c\uff0c\u56e0\u4e3a\u9875\u9762\u72b6\u6001\u5c06\u4e0e<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u7684\u5185\u90e8\u72b6\u6001\u4e0d\u540c\u6b65\u3002<\/span> <span data-contrast=\"auto\">\u56e0\u6b64\uff0c\u6211\u4eec\u5728\u5e55\u540e\u6240\u505a\u7684\u5c31\u662f\u53d6\u6d88<\/span><span data-contrast=\"auto\"> JavaScript <\/span><span data-contrast=\"auto\">\u79fb\u52a8\uff0c\u8fd9\u6837\u88ab\u79fb\u52a8\u7684\u9879\u76ee\u5c31\u4e0d\u4f1a\u771f\u7684\u5728\u9875\u9762\u4e0a\u79fb\u52a8\u3002\u7136\u540e\u6211\u4eec\u79fb\u52a8\u5217\u8868\u4e2d\u7684\u9879\u76ee\uff0c<\/span><span data-contrast=\"auto\">Blazor <\/span><span data-contrast=\"auto\">\u5c06\u6309\u7167\u65b0\u987a\u5e8f\u91cd\u65b0\u6e32\u67d3\u5217\u8868<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">\u4e00\u4e2a\u66f4\u590d\u6742\u7684\u4f8b\u5b50<\/span><\/b><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">SortableJS <\/span><span data-contrast=\"auto\">\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5e93\uff0c\u5b83\u53ef\u4ee5\u505a\u7684\u4e0d\u4ec5\u4ec5\u662f\u6392\u5e8f\u5217\u8868\u3002\u5b83\u8fd8\u53ef\u4ee5\u5728\u5217\u8868\u4e4b\u95f4\u6392\u5e8f\u3001\u514b\u9686\u9879\u76ee\u3001\u8fc7\u6ee4\u9879\u76ee\u7b49\u7b49\u3002<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\">SortableList<\/span><span data-contrast=\"auto\">\u7ec4\u4ef6\u652f\u6301\u8bb8\u591a\u8fd9\u6837\u7684\u529f\u80fd\u3002\u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u66f4\u590d\u6742\u7684\u4f8b\u5b50\u2014\u2014\u4e24\u4e2a\u5217\u8868\u4e4b\u95f4\u7684\u6392\u5e8f<\/span><span data-contrast=\"auto\">&#8230;&#8230;<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">&lt;div&gt;\r\n    &lt;div class=\"container\"&gt;\r\n        &lt;div class=\"columns\"&gt;\r\n            &lt;div class=\"column\"&gt;\r\n                &lt;h3&gt;Books&lt;\/h3&gt;\r\n                &lt;SortableList Items=\"books\" Context=\"book\" OnRemove=\"@AddToFavoriteList\" Group=\"favorites\"&gt;\r\n                    &lt;SortableItemTemplate&gt;\r\n                        &lt;div class=\"book\"&gt;\r\n                            &lt;p&gt;@book.Title&lt;\/p&gt;\r\n                        &lt;\/div&gt;\r\n                    &lt;\/SortableItemTemplate&gt;\r\n                &lt;\/SortableList&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"column\"&gt;\r\n                &lt;h3&gt;Favorite Books&lt;\/h3&gt;\r\n                &lt;SortableList Items=\"favoriteBooks\" Context=\"book\" OnRemove=\"@RemoveFromFavoriteList\" Group=\"favorites\"&gt;\r\n                    &lt;SortableItemTemplate&gt;\r\n                        &lt;div class=\"book\"&gt;\r\n                            &lt;p&gt;@book.Title&lt;\/p&gt;\r\n                        &lt;\/div&gt;\r\n                    &lt;\/SortableItemTemplate&gt;\r\n                &lt;\/SortableList&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/div&gt;<\/code><\/pre>\n<p><span data-contrast=\"auto\">\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u6709\u4e24\u4e2a\u5217\u8868<\/span><span data-contrast=\"auto\"> &#8211; <\/span><span data-contrast=\"auto\">\u6240\u6709\u4e66\u7c4d\u7684\u5217\u8868\u548c\u6700\u559c\u6b22\u7684\u4e66\u7c4d\u7684\u5217\u8868\u3002<\/span> <span data-contrast=\"auto\">\u5b83\u4eec\u901a\u8fc7<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> Group <\/span><span data-contrast=\"auto\">\u5c5e\u6027\u94fe\u63a5\u5728\u4e00\u8d77<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u6211\u4eec\u5e0c\u671b\u80fd\u591f\u5c06\u4e66\u7c4d\u4ece\u6240\u6709\u4e66\u7c4d\u5217\u8868\u62d6\u653e\u5230\u6700\u559c\u6b22\u7684\u4e66\u7c4d\u5217\u8868\u4e2d\u3002\u8981\u505a\u5230\u8fd9\u4e00\u70b9\uff0c\u6211\u4eec\u9700\u8981\u5904\u7406\u4e24\u4e2a\u5217\u8868\u7684<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\">OnRemove<\/span><span data-contrast=\"auto\">\u4e8b\u4ef6<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">public void AddToFavoriteList((int oldIndex, int newIndex) indices)\r\n{\r\n    var (oldIndex, newIndex) = indices;\r\n\r\n    var book = books[oldIndex];\r\n    favoriteBooks.Insert(newIndex, book);\r\n    books.RemoveAt(oldIndex);\r\n}\r\n\r\npublic void RemoveFromFavoriteList((int oldIndex, int newIndex) indices)\r\n{\r\n    var (oldIndex, newIndex) = indices;\r\n\r\n    var book = favoriteBooks[oldIndex];\r\n    books.Insert(newIndex, book);\r\n    favoriteBooks.RemoveAt(oldIndex);\r\n}<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-blazor-sortable\/blazor-sortable.gif\" alt=\"a screenshot of multiple lists linked together\" \/><\/p>\n<h3><b><span data-contrast=\"auto\">\u8bbe\u7f6e<\/span><\/b><b><span data-contrast=\"auto\"> SortableList <\/span><\/b><b><span data-contrast=\"auto\">\u7684\u6837\u5f0f<\/span><\/b><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<\/span><span data-contrast=\"auto\"><span style=\"color: #ff0000;\">SortableList<\/span> <\/span><span data-contrast=\"auto\">\u5305\u542b\u4e00\u4e9b\u9ed8\u8ba4\u6837\u5f0f\uff0c\u8fd9\u4e9b\u6837\u5f0f\u5728\u62d6\u52a8\u65f6\u4f1a\u9690\u85cf<\/span><span data-contrast=\"auto\">\u201c<\/span><span data-contrast=\"none\">ghost<\/span><span data-contrast=\"auto\">\u201d<\/span><span data-contrast=\"auto\">\u5143\u7d20\u3002<\/span> <span data-contrast=\"auto\">\u8fd9\u5c06\u5728\u60a8\u62d6\u52a8\u65f6\u5728\u9879\u76ee\u4e4b\u95f4\u4ea7\u751f\u95f4\u9699\u3002<\/span> <span data-contrast=\"auto\">\u5982\u679c\u6ca1\u6709\u8fd9\u79cd\u6837\u5f0f\u66f4\u6539\uff0c\u9879\u76ee\u672c\u8eab\u5c06\u663e\u793a\u4e3a\u53ef\u653e\u7f6e\u62d6\u52a8\u9879\u76ee\u7684\u76ee\u6807\u3002<\/span> <span data-contrast=\"auto\">\u8fd9\u6709\u70b9\u5947\u602a\uff0c\u56e0\u4e3a\u8fd9\u610f\u5473\u7740\u60a8\u62d6\u52a8\u7684\u9879\u76ee\u4e5f\u662f\u60a8\u653e\u7f6e\u62d6\u52a8\u9879\u76ee\u7684\u76ee\u7684\u5730<\/span><span data-contrast=\"auto\">\u3002 <\/span><span data-contrast=\"auto\">\u4f46\u5982\u679c\u8fd9\u5c31\u662f\u60a8\u60f3\u8981\u9009\u7684\u6837\u5f0f\uff0c\u60a8\u53ef\u4ee5\u8986\u76d6<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList.razor.css <\/span><span data-contrast=\"auto\">\u6587\u4ef6\u4e2d\u7684\u6837\u5f0f\uff0c\u6216\u8005\u6839\u672c\u4e0d\u5305\u542b\u5b83<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u7531\u4e8e<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList <\/span><span data-contrast=\"auto\">\u5185\u5448\u73b0\u7684\u6240\u6709\u5185\u5bb9\u90fd\u5448\u73b0\u5728<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableItemTemplate <\/span><span data-contrast=\"auto\">\u5b50\u9879\u5185\uff0c\u56e0\u6b64\u60a8\u5fc5\u987b\u4f7f\u7528<\/span><span data-contrast=\"auto\">\u201c::deep\u201d<\/span><span data-contrast=\"auto\">\u4fee\u9970\u7b26\u624d\u80fd\u4f7f\u4efb\u4f55\u66f4\u6539\u751f\u6548<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u5982\u679c\u60a8\u4ece\u7236\u9875\u9762<\/span><span data-contrast=\"auto\">\/<\/span><span data-contrast=\"auto\">\u7ec4\u4ef6\uff08\u5373<\/span><span data-contrast=\"auto\"> Index.razor.css<\/span><span data-contrast=\"auto\">\uff09\u8bbe\u7f6e<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList <\/span><span data-contrast=\"auto\">\u7684\u6837\u5f0f\uff0c\u5219\u5fc5\u987b\u5c06<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList <\/span><span data-contrast=\"auto\">\u5305\u88c5\u5728\u5bb9\u5668\u5143\u7d20\u4e2d\uff0c\u5e76\u4f7f\u7528<\/span><span data-contrast=\"auto\">\u201c::deep\u201d<\/span><span data-contrast=\"auto\">\u4fee\u9970\u7b26\u3002<\/span> <span data-contrast=\"auto\">\u5982\u679c\u60a8\u4e0d\u8fd9\u6837\u505a\uff0c\u60a8\u7684\u6837\u5f0f\u5c06\u4e0d\u4f1a\u751f\u6548\uff0c\u60a8\u4e5f\u4f1a\u56e0\u4e3a\u6211\u5236\u4f5c\u8fd9\u4e2a\u7ec4\u4ef6\u5374\u6ca1\u6709\u8fd9\u4e2a\u529f\u80fd\u800c\u611f\u5230\u60b2\u4f24\u3001\u56f0\u60d1\u548c\u751f\u6c14\u3002<\/span> <span data-contrast=\"auto\">\u8fd9\u662f<\/span><span data-contrast=\"auto\"> Blazor <\/span><span data-contrast=\"auto\">\u7684\u95ee\u9898\uff0c\u800c\u4e0d\u662f<\/span><span data-contrast=\"auto\"> SortableJS <\/span><span data-contrast=\"auto\">\u7684\u95ee\u9898<\/span><span data-contrast=\"auto\">\u3002 <\/span><span data-contrast=\"auto\">\u60a8\u53ef\u4ee5\u5728<\/span> <a href=\"https:\/\/learn.microsoft.com\/en-us\/aspnet\/core\/blazor\/components\/css-isolation?view=aspnetcore-7.0#child-component-support\"><span data-contrast=\"auto\">ASP.NET Core <\/span><span data-contrast=\"none\">\u6587\u6863<\/span><\/a><span data-contrast=\"auto\">\u4e2d\u9605\u8bfb\u6709\u5173\u8303\u56f4\u6837\u5f0f\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u6211\u89c9\u5f97\u6ca1\u6709\u4eba\u4f1a\u8bfb\u6700\u540e\u4e00\u6bb5\uff0c\u5f88\u591a\u4eba\u53ef\u80fd\u4f1a\u54c0\u53f7\u3002\u6211\u5148\u8bf4\u58f0\u62b1\u6b49\uff0c\u4f46\u5176\u5b9e\u6211\u5df2\u7ecf\u5c1d\u8bd5\u8fc7\u4e86<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">\u4e3a\u4ec0\u4e48\u4e0d\u4f7f\u7528<\/span><\/b><b><span data-contrast=\"auto\"> HTML5 <\/span><\/b><b><span data-contrast=\"auto\">\u62d6\u653e\uff1f<\/span><\/b><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">\u8fd9\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u95ee\u9898\uff0c\u4e5f\u662f\u6211\u5728\u4f7f\u7528<\/span><span data-contrast=\"auto\"> JavaScript <\/span><span data-contrast=\"auto\">\u89e3\u51b3\u65b9\u6848\u4e4b\u524d\u7814\u7a76\u8fc7\u7684\u4e00\u4e2a\u95ee\u9898\u3002\u603b\u800c\u8a00\u4e4b\uff0c\u539f\u751f<\/span><span data-contrast=\"auto\"> HTML5 <\/span><span data-contrast=\"auto\">\u5bf9\u62d6\u653e\u7684\u652f\u6301\u8fd8\u4e0d\u591f\u5f3a\u5927\uff0c\u65e0\u6cd5\u5b9e\u73b0\u5408\u9002\u7684\u6392\u5e8f\u3002\u4f8b\u5982\uff0c\u65e0\u6cd5\u5bf9\u5927\u90e8\u5206\u62d6\u653e\u884c\u4e3a\u8fdb\u884c\u6837\u5f0f\u5316\u3002\u5b83\u770b\u8d77\u6765<\/span><span data-contrast=\"auto\">\u2026\u2026<\/span><span data-contrast=\"auto\">\u5f88\u611a\u8822<\/span><span data-contrast=\"auto\">\u2026\u2026<\/span><span data-contrast=\"auto\">\u800c\u4e14\u6211\u4eec\u5bf9\u6b64\u65e0\u80fd\u4e3a\u529b\u3002\u5b83\u5bf9\u8de8\u6d4f\u89c8\u5668\u7684<\/span><a href=\"https:\/\/caniuse.com\/?search=drag\"><span data-contrast=\"none\">\u652f\u6301\u4e5f\u5f88\u4e0d\u7a33\u5b9a<\/span><\/a><span data-contrast=\"auto\">\u3002\u6709\u4e00\u4e9b\u57fa\u672c\u5c5e\u6027\u4ec5\u9002\u7528\u4e8e<\/span><span data-contrast=\"auto\"> Chrome\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u7efc\u4e0a\u6240\u8ff0\uff0c<\/span><span data-contrast=\"auto\">SortableJS<\/span><span data-contrast=\"auto\">\u5b9e\u9645\u4e0a\u4f1a\u5c1d\u8bd5\u4f7f\u7528<\/span><span data-contrast=\"auto\">HTML5<\/span><span data-contrast=\"auto\">\u62d6\u653e\uff0c\u5e76\u5728<\/span><span data-contrast=\"auto\">iOS<\/span><span data-contrast=\"auto\">\u7b49\u5e73\u53f0\u4e0a\u9000\u56de\u5230<\/span><span data-contrast=\"auto\">JavaScript<\/span><span data-contrast=\"auto\">\u89e3\u51b3\u65b9\u6848\u3002\u4f46\u662f\uff0c\u60a8\u4ecd\u7136\u65e0\u6cd5\u63a7\u5236\u6837\u5f0f\uff0c\u5e76\u4e14\u4f1a\u51fa\u73b0\u770b\u8d77\u6765\u611a\u8822\u7684\u62d6\u653e\u64cd\u4f5c\u3002\u6240\u4ee5\u6211\u5728<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> SortableList <\/span><span data-contrast=\"auto\">\u4e0a\u5173\u95ed\u4e86<\/span><span data-contrast=\"auto\"> HTML5 <\/span><span data-contrast=\"auto\">\u7684\u65b9\u5f0f\u3002\u5982\u679c\u60a8\u5e0c\u671b\u5b83\u91cd\u65b0\u6253\u5f00\uff0c\u8bf7\u8fdb\u5165<\/span><span data-contrast=\"auto\"><span style=\"color: #ff0000;\"> SortableList.razor.razor.js<\/span> <\/span><span data-contrast=\"auto\">\u6587\u4ef6\u5e76\u5220\u9664<\/span><span style=\"color: #ff0000;\" data-contrast=\"auto\"> forceFallback: true <\/span><span data-contrast=\"auto\">\u5c5e\u6027\u3002\u6211\u53ef\u80fd\u4f1a\u5728\u67d0\u4e2a\u65f6\u5019\u5c06\u5176\u4f5c\u4e3a\u4e00\u4e2a\u8bbe\u7f6e<\/span><span data-contrast=\"auto\">\u3002<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<h3><b><span data-contrast=\"auto\">\u83b7\u53d6<\/span><\/b><b><span data-contrast=\"auto\"> Blazor Sortable<\/span><\/b><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">\u67e5\u770b<\/span><a href=\"https:\/\/blazorsortable.theurlist.com\/\"><span data-contrast=\"none\">Blazor Sortable<\/span><\/a><span data-contrast=\"auto\">\u5e76\u544a\u8bc9\u6211\u4eec\u60a8\u7684\u60f3\u6cd5\uff01\u60a8\u53ef\u4ee5\u7528\u5b83\u505a\u5f88\u591a\u4e8b\u60c5\uff0c\u5305\u62ec\u514b\u9686\u9879\u76ee\u3001\u7981\u7528\u67d0\u4e9b\u9879\u76ee\u7684\u6392\u5e8f\u3001\u6307\u5b9a\u62d6\u52a8\u624b\u67c4\u7b49\u7b49\u3002\u6211\u4eec\u8fd8\u6ca1\u6709\u5b9e\u73b0<\/span><span data-contrast=\"auto\"> SortableJS<\/span><span data-contrast=\"auto\">\u7684\u6240\u6709\u529f\u80fd\u3002\u6b22\u8fce\u62c9\u53d6\u8bf7\u6c42\uff01<\/span><span data-contrast=\"auto\">\ud83d\ude09<\/span><span data-ccp-props=\"{&quot;134245417&quot;:false,&quot;335551550&quot;:6,&quot;335551620&quot;:6}\">\u00a0<\/span><\/p>\n<blockquote><p><span data-contrast=\"auto\">Blazor Sortable <\/span><span data-contrast=\"auto\">\u662f\u4e00\u4e2a\u5f00\u6e90\u793e\u533a\u9879\u76ee\u3002<\/span><\/p><\/blockquote>\n<p>\u5982\u679c\u5927\u5bb6\u6709\u4efb\u4f55\u7684\u6280\u672f\u95ee\u9898\uff0c\u6b22\u8fce\u5230\u6211\u4eec\u7684\u5b98\u65b9\u7684<a href=\"https:\/\/learn.microsoft.com\/zh-cn\/answers\/tags\/97\/dotnet\">.NET\u4e2d\u6587\u8bba\u575b<\/a> \u63d0\u95ee\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7bc7\u7ffb\u8bd1\u4e8eBurke Holland\u7684Sortable Lists for Blazor using a SortableJS Component \u00a0 \u5728Web \u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4e00\u4e2a\u5e38\u89c1\u529f\u80fd\u90e8\u5206\u662f\u53ef\u6392\u5e8f\u5217\u8868\u3002SortableJS\u662f\u6211\u6700\u559c\u6b22\u7684 JavaScript \u5e93\u4e4b\u4e00\uff0c\u5728\u8fdb\u884c Blazor \u5f00\u53d1\u65f6\u6211\u5f88\u60f3\u5ff5\u5b83\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u51b3\u5b9a\u5305\u88c5 SortableJS \u5e93\uff0c\u4f7f\u5176\u6210\u4e3a Blazor \u7ec4\u4ef6\uff0c\u540d\u4e3aBazor Sortable\uff0c\u6211\u5df2\u5728 GitHub \u4e0a\u5f00\u6e90\u4e86\u5b83\uff0c\u6211\u76f8\u4fe1\u60a8\u4f1a\u559c\u6b22\u5b83\u7684\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5f15\u5bfc\u60a8\u4e86\u89e3\u5982\u4f55\u5c06\u5176\u6dfb\u52a0\u5230\u60a8\u81ea\u5df1\u7684 Blazor Web \u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002\u00a0 \u6ce8\u610f\uff1aBlazor Sortable \u662f\u4e00\u4e2a\u5f00\u6e90\u793e\u533a\u7ec4\u4ef6\uff0c\u800c\u4e0d\u662f Microsoft \u7684\u5b98\u65b9\u7ec4\u4ef6\u3002Blazor\u7684 Fluent UI\u56e2\u961f\u6b63\u5728\u81f4\u529b\u4e8e\u5728\u5373\u5c06\u53d1\u5e03\u7684 Blazor\u7684Fluent UI \u7248\u672c\u4e2d\u96c6\u6210\u53ef\u6392\u5e8f\u7ec4\u4ef6\u3002\u60a8\u73b0\u5728\u53ef\u4ee5\u5c1d\u8bd5Fluent UI Sortable Demo\u3002\u00a0 \u8bf7\u5728\u8fd9\u91cc\u67e5\u770b\u6f14\u793a\uff1a https: \/\/blazorsortable.theurlist.com\u00a0 \u6bcf\u5468\u4e94\uff0cJon Galloway\uff08\u867d\u7136\u4f60\u53ef\u80fd\u4ece\u672a\u542c\u8bf4\u8fc7\u4ed6\uff0c\u4f46\u4ed6\u503c\u5f97\u4fe1\u8d56\uff09\u548c\u6211\u81f4\u529b\u4e8e\u5728 Blazor \u4e2d\u91cd\u5efa\u4e00\u4e2a\u540d\u4e3atheurlist.com\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u8be5\u76f4\u64ad\u5728 Twitch \u548c .NET YouTube \u4e0a\u88ab\u79f0\u4e3a\u201c Burke Learns Blazor \u201d\uff08\u70b9\u8d5e\u5e76\u8ba2\u9605\uff01\uff09\u3002\u5982\u679c\u60a8\u613f\u610f\u52a0\u5165\u6211\u4eec\uff0c\u6211\u4eec\u5c06\u4f1a\u975e\u5e38\u9ad8\u5174\u3002\u7531\u4e8e\u6211\u4e0d\u77e5\u9053\u6211\u4eec\u73b0\u5728\u9700\u8981\u505a\u4e9b\u4ec0\u4e48\uff0c\u6240\u6709\u6211\u4eec\u9700\u8981\u5c3d\u53ef\u80fd\u591a\u7684\u5e2e\u52a9\u6765\u4e00\u8d77\u5904\u7406\u8fd9\u4ef6\u4e8b\u3002\u00a0 [&hellip;]<\/p>\n","protected":false},"author":97248,"featured_media":606,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2,6,14],"class_list":["post-604","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet-ch","tag-net","tag-asp-net","tag-blazor"],"acf":[],"blog_post_summary":"<p>\u672c\u7bc7\u7ffb\u8bd1\u4e8eBurke Holland\u7684Sortable Lists for Blazor using a SortableJS Component \u00a0 \u5728Web \u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4e00\u4e2a\u5e38\u89c1\u529f\u80fd\u90e8\u5206\u662f\u53ef\u6392\u5e8f\u5217\u8868\u3002SortableJS\u662f\u6211\u6700\u559c\u6b22\u7684 JavaScript \u5e93\u4e4b\u4e00\uff0c\u5728\u8fdb\u884c Blazor \u5f00\u53d1\u65f6\u6211\u5f88\u60f3\u5ff5\u5b83\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u51b3\u5b9a\u5305\u88c5 SortableJS \u5e93\uff0c\u4f7f\u5176\u6210\u4e3a Blazor \u7ec4\u4ef6\uff0c\u540d\u4e3aBazor Sortable\uff0c\u6211\u5df2\u5728 GitHub \u4e0a\u5f00\u6e90\u4e86\u5b83\uff0c\u6211\u76f8\u4fe1\u60a8\u4f1a\u559c\u6b22\u5b83\u7684\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5f15\u5bfc\u60a8\u4e86\u89e3\u5982\u4f55\u5c06\u5176\u6dfb\u52a0\u5230\u60a8\u81ea\u5df1\u7684 Blazor Web \u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002\u00a0 \u6ce8\u610f\uff1aBlazor Sortable \u662f\u4e00\u4e2a\u5f00\u6e90\u793e\u533a\u7ec4\u4ef6\uff0c\u800c\u4e0d\u662f Microsoft \u7684\u5b98\u65b9\u7ec4\u4ef6\u3002Blazor\u7684 Fluent UI\u56e2\u961f\u6b63\u5728\u81f4\u529b\u4e8e\u5728\u5373\u5c06\u53d1\u5e03\u7684 Blazor\u7684Fluent UI \u7248\u672c\u4e2d\u96c6\u6210\u53ef\u6392\u5e8f\u7ec4\u4ef6\u3002\u60a8\u73b0\u5728\u53ef\u4ee5\u5c1d\u8bd5Fluent UI Sortable Demo\u3002\u00a0 \u8bf7\u5728\u8fd9\u91cc\u67e5\u770b\u6f14\u793a\uff1a https: \/\/blazorsortable.theurlist.com\u00a0 \u6bcf\u5468\u4e94\uff0cJon Galloway\uff08\u867d\u7136\u4f60\u53ef\u80fd\u4ece\u672a\u542c\u8bf4\u8fc7\u4ed6\uff0c\u4f46\u4ed6\u503c\u5f97\u4fe1\u8d56\uff09\u548c\u6211\u81f4\u529b\u4e8e\u5728 Blazor \u4e2d\u91cd\u5efa\u4e00\u4e2a\u540d\u4e3atheurlist.com\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u8be5\u76f4\u64ad\u5728 Twitch \u548c .NET YouTube \u4e0a\u88ab\u79f0\u4e3a\u201c Burke Learns Blazor \u201d\uff08\u70b9\u8d5e\u5e76\u8ba2\u9605\uff01\uff09\u3002\u5982\u679c\u60a8\u613f\u610f\u52a0\u5165\u6211\u4eec\uff0c\u6211\u4eec\u5c06\u4f1a\u975e\u5e38\u9ad8\u5174\u3002\u7531\u4e8e\u6211\u4e0d\u77e5\u9053\u6211\u4eec\u73b0\u5728\u9700\u8981\u505a\u4e9b\u4ec0\u4e48\uff0c\u6240\u6709\u6211\u4eec\u9700\u8981\u5c3d\u53ef\u80fd\u591a\u7684\u5e2e\u52a9\u6765\u4e00\u8d77\u5904\u7406\u8fd9\u4ef6\u4e8b\u3002\u00a0 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/users\/97248"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/comments?post=604"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/604\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media\/606"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media?parent=604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/categories?post=604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/tags?post=604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}