[英]Change direction of layout to RTL in Ant Design Blazor
How can I change direction of layout to RTL in Ant Blazor?如何在 Ant Blazor 中将布局方向更改为 RTL? There is not documentation about this.
没有关于此的文档。 I mean changing direction to RTL similar the way Ant Blazor website changes direction by a button in header and using ConfigProvider.
我的意思是将方向更改为 RTL,类似于 Ant Blazor 网站通过 header 中的按钮更改方向并使用 ConfigProvider 的方式。
After spending much time, I found that Router tag in App.razor should be wrapped inside ConfigProvider tag.花了很多时间,我发现 App.razor 中的 Router 标签应该被包裹在 ConfigProvider 标签中。
<ConfigProvider>
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</ConfigProvider>
<AntContainer />
After that you could use ConfigProvider as a CascadingParameter in your razor files.之后,您可以在 razor 文件中将 ConfigProvider 用作 CascadingParameter。
[CascadingParameter] public ConfigProvider ConfigProvider { get; set; }
You just need to change the html tag to this:您只需将 html 标签更改为:
<html dir="rtl" data-direction="rtl">
and it will change the direction to rtl它将改变方向到 rtl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.