我使用 Tailwind CSS。我有两个粘性位置,一个粘性标题,另一个粘性侧边栏。我的粘性标题工作正常:
<body>
<!-- haed -->
<header class="sticky z-50 top-0 hidden">
<!-- searchbar -->
<div class="grid grid-cols-12 p-1 sm:py-3 md:px-16 md:py-12 xl:px-32 xl:pt-24 bg-gray-100">
<div class="col-span-12 mb-2 lg:col-span-3 ">
<span id="btnMenu" onclick="toggleButton(); return false">
<i class="fal fa-2x fa-bars hover:bg-white"></i>
</span>
<span class="mx-2 float-left lg:float-none lg:mx-6">Logo</span>
</div>
<div class="col-span-12 lg:col-span-9">
<span class="w-full h-10 bg-gray-200 cursor-pointer border border-gray-300 text-sm rounded-full flex">
<input type="search" name="serch" placeholder="Search..."
class="flex-grow px-4 rounded-l-full rounded-r-full text-sm focus:outline-none"> <i
class="fas fa-search m-3 mr-5 text-lg text-gray-700 w-4 h-4"> </i> …
Run Code Online (Sandbox Code Playgroud) 我有一个包含 Blazor Web 程序集和使用个人用户帐户(身份验证)托管的 Asp.Net Core 的项目。但我有两个问题。首先我想要自定义注册并登录查看(与身份服务器4相关),但我找不到视图。在服务器项目(blazor server)中_LoginPartial.cshtml
查看,我们可以看到很多页面:、asp-area="Identity" asp-page="/Account/Manage/Index"
等等...但是Identity文件夹是空的!同样在 Blazor 客户端中我们有页面:asp-area="Identity" asp-page="/Account/Logout"
asp-area="Identity" asp-page="/Account/Register"
LoginDisplay.razor
<NotAuthorized>
<a href="authentication/register">Register</a>
<a href="authentication/login">Log in</a>
</NotAuthorized>
Run Code Online (Sandbox Code Playgroud)
在 Pages 文件夹中我们有Authentication.razor
Component :
@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
<RemoteAuthenticatorView Action="@Action" />
@code{
[Parameter] public string Action { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
Authentication.razor
组件间接调用 IdentityServer4。
如何找到 Identity Server 4 视图并更改它?
第二个问题是当我想在启动文件 blazor 服务器中使用自定义身份模型时。
默认代码是:
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
Run Code Online (Sandbox Code Playgroud)
当我更改为:
services.AddIdentity<ApplicationUser,Role>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
Run Code Online (Sandbox Code Playgroud)
当我运行项目并单击登录或注册按钮(Authentication.razor
)调用 IdentityServer(例如https://localhost:5001/Identity/Account/Register?returnUrl=%2Fauthentication%2Flogin …
identityserver4 blazor-server-side blazor-client-side blazor-webassembly
我正在使用 dot net standard 2.1 和 c# 8,我想为我的类(接口)创建一个事件,我按照本教程 编写了一个接口:
using System;
using Crawler.Paging;
namespace Crawler
{
public interface ICrawler
{
public event EventHandler NextPage;
protected virtual void OnNextPage(EventArgs e)
{
EventHandler handler = NextPage;
handler?.Invoke(this,e);
}
void Paging(IPaging paging);
}
}
Run Code Online (Sandbox Code Playgroud)
但请告诉我一个错误:
错误事件“ICrawler.NextPage”只能出现在+=或-=的左侧
我继续进行了这个训练,那么问题出在哪里呢?