小编O.M*_*Koh的帖子

如何修复“未找到规则‘@typescript-eslint/no-use-before-declare’的定义。eslint(@typescript-eslint/no-use-before-declare)”

我是 eslint 的新手,我不知道如何解决这个问题。我的导入的开头总是用红线下划线。它抱怨找不到指定规则的定义。我想保留这条规则,因为它似乎在其他方面很有用。在此处输入图片说明.

对于我的 .eslintrc.js 文件,我设置了以下规则:

`

module.exports = {
    env: {
        browser: true,
        node: true
    },
    extends: [
        'eslint:recommended',
        'plugin:@typescript-eslint/eslint-recommended',
        'plugin:@typescript-eslint/recommended',
        'plugin:@typescript-eslint/recommended-requiring-type-checking',
        'prettier'
    ],
    parser: '@typescript-eslint/parser',
    parserOptions: {
        project: 'tsconfig.json',
        sourceType: 'module'
    },
    plugins: ['@typescript-eslint', '@typescript-eslint/tslint'],
    rules: {
        '@typescript-eslint/class-name-casing': 'error',
        '@typescript-eslint/consistent-type-definitions': 'error',
        '@typescript-eslint/explicit-member-accessibility': [
            'off',
            {
                accessibility: 'explicit'
            }
        ],
        '@typescript-eslint/indent': ['error', 'tab'],
        '@typescript-eslint/member-delimiter-style': [
            'error',
            {
                multiline: {
                    delimiter: 'semi',
                    requireLast: true
                },
                singleline: {
                    delimiter: 'semi',
                    requireLast: false
                }
            }
        ],
        '@typescript-eslint/member-ordering': 'error',
        '@typescript-eslint/no-empty-function': 'off',
        '@typescript-eslint/no-empty-interface': …
Run Code Online (Sandbox Code Playgroud)

typescript eslint

13
推荐指数
4
解决办法
2万
查看次数

当从不同域上的 API 发出 cookie 时,Safari iOS“防止跨站点跟踪”选项是否有解决方法?

是否有任何解决方法可以让我保持启用“防止跨站点跟踪”选项(默认情况下,因此每个用户都会启用它),并从位于不同域的后端 api 发出 CORS cookie比我的角度应用程序?

我的应用程序流程如下: 1. 用户登录 2. 服务器进行身份验证,发出 JWT 并将 JWT 存储在 HttpOnly cookie 中 3. 所有 Angular 请求都具有 {withCredentials: true}

这在....windows 桌面浏览器上工作得很好。但是,当我尝试在 Safari iOS 和 mac Safari 上登录时,cookie 不会保存,也不会随后续请求一起发送。

我发现禁用“防止跨站点跟踪”选项有效,但我不能指望我的所有用户都禁用此选项以使用我的应用程序。

现在有什么解决方法吗?

safari mobile-safari asp.net-core angular

12
推荐指数
1
解决办法
6994
查看次数

有没有办法增加 IntelliSense 的字体大小?

我无法在 Visual Studio 2017 中找到该选项。我知道您可以更改正在编写的代码的字体,但没有看到 IntelliSense 选项让我认为这是不可能的。

intellisense visual-studio-2017

9
推荐指数
1
解决办法
3157
查看次数

为什么 Identity Server GetLogoutContextAsync() 方法总是为 PostLogoutRedirectUri 返回 null?

身份服务器正在按预期工作。我可以登录用户并注销用户。然而,对象PostLogoutRedirectUri的属性LogoutRequest总是返回为空。

我的 SPA 客户端配置:

    {
        ClientId = "pokemon",
        ClientName = "Angular Pokemon Client",
    
        AllowedGrantTypes = GrantTypes.Code,
        RequireClientSecret = false,
        RedirectUris =           { "http://localhost:4200/login" },
        PostLogoutRedirectUris = { "http://localhost:4200" },
        AllowedCorsOrigins =     { "http://localhost:4200" },
        AllowOfflineAccess = true,
        AllowAccessTokensViaBrowser = true,
        AllowRememberConsent = false,
        RequireConsent = true,
    
         AllowedScopes = 
         {
             IdentityServerConstants.StandardScopes.OpenId,
             IdentityServerConstants.StandardScopes.Profile,
             "scope1"
         }
}
Run Code Online (Sandbox Code Playgroud)

对象的设置AccountOptions为:

public static bool AllowLocalLogin = true;
public static bool AllowRememberLogin = true;
/.../
public static bool ShowLogoutPrompt = false; …
Run Code Online (Sandbox Code Playgroud)

identityserver4

6
推荐指数
1
解决办法
2820
查看次数

使用 BottomNavigationBar 时如何通过屏幕导航缓存 FutureBuilder 异步结果?

我用来BottomNavigationBar显示三个菜单的列表。当用户选择时,Gallery我渲染一个在其方法中Stateful渲染的组件。这按预期工作,但当用户导航到另一个屏幕时,小部件被处理掉,因此我丢失了刚刚获取的所有图像。如何有效地缓存它们?FutureBuilderbuildGallery

home-page.dart小部件:

final List<Widget> _menuOptions = <Widget>[
    Text(
      'Schedules',
      style: optionStyle
    ),
    Text(
      'Stats',
      style: optionStyle
    ),    
    GalleryPage(key: PageStorageKey('gallery'))
  ];

void _onMenuSelected(int index){
    setState(() {      
      _selectedIndex = index;
    });
  }
@override
  Widget build(BuildContext context){
    //...
    body: Center(
      child: _menuOptions.elementAt(_selectedIndex),
    ),
    bottomNavigationBar: BottomNavigationBar(
      items: const <BottomNavigationBarItem>[
        BottomNavigationBarItem(
          icon: Icon(Icons.schedule),
          title: Text('Schedules'),
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.satellite),
          title: Text('Stats'),
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.image),
          title: Text('Gallery'),          
        ),
      ],
      currentIndex: _selectedIndex,
      selectedItemColor: Colors.amber[800],
      onTap: _onMenuSelected, …
Run Code Online (Sandbox Code Playgroud)

flutter

5
推荐指数
0
解决办法
1173
查看次数

在 Flutter 中,调用 Navigator.pop(context) 时,ListView.builder 会闪烁刚刚显示的图片,为什么?

我正在使用ListView.builder()构建图像列表。当使用点击图像时,我将图像放大并通过 flutter 将其显示在照片库中Navigator

这是问题的快速记录:https : //youtu.be/4C5MtXMSwLk

gallery-page.dart where I build the list of images
Widget build(BuildContext context) {    
    return FutureBuilder(
      future: this.futureGalleryImages,
      builder: (BuildContext context, AsyncSnapshot snapshot) {
        switch (snapshot.connectionState) {
          case ConnectionState.waiting:
            return CircularProgressIndicator();            
          default:
            if (snapshot.hasError)
              return Text('Error: ${snapshot.error}');
            else              
              return _createListView(context, snapshot);              
        }
      },
    );
Run Code Online (Sandbox Code Playgroud)

一旦列表视图是构造函数,每个 ListTile 都有 onTap 事件侦听器的打开回调:

void open(BuildContext context, List<GalleryImage> images, final int index){
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => GalleryPhotoViewWrapper(
          galleryItems: images,
          backgroundDecoration: widget.backgroundDecoration,
          initialIndex: index,
          scrollDirection: …
Run Code Online (Sandbox Code Playgroud)

listview flutter

5
推荐指数
0
解决办法
299
查看次数

无法选择 Angular Material 芯片并指示该芯片已被选中?

我无法实现芯片选择并向用户表明该芯片已被选择。

我有以下 html 模板代码:

<mat-chip-list [multiple]="true" [selectable]="true">
  <mat-chip selected (selectionChange)="onSelectedChip($event)" [selectable]="true"  *ngFor="let size of sizes | sizeEnumToSize">{{ size }}</mat-chip>
</mat-chip-list>
Run Code Online (Sandbox Code Playgroud)

最初我只是想让所有芯片都处于选定状态。我希望芯片能够直观地改变其状态,以向用户显示它已被选择。我也尝试过做 [selected]="true" 但这会产生与预期相同的正常列表。

我在这里缺少什么?

angular-material2 angular

3
推荐指数
1
解决办法
5180
查看次数

如何根据某个对象的 id 过滤订阅事件?

我希望能够根据对象 ID 过滤某些操作的订阅。例如我想做这样的事情:

subscription{
  onTaskCompleted(taskId: "1"){
    taskCompleted{
      status
      items{
        reason
        iD
      }
    }
    taskFailed{
      status
      details{
        detail
        status        
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

仅当 ID 为“1”的任务完成时才会发出该事件。

是否有一种内置的方法可以HotChocolate使用某种类型的过滤来做到这一点?

或者

我是否必须自己添加这种类型的过滤,通过在解析器中执行类似的操作:

if(_taskIds.Contains(taskId))
{
   TaskCompletedExecution taskFinished = new TaskCompletedExecution(taskCompleted);
   await eventSender.SendAsync(nameof(TaskListSubscriptions.OnTaskCompleted), taskFinished, 
   cancellationToken);
}
Run Code Online (Sandbox Code Playgroud)

谢谢

graphql graphql-subscriptions hotchocolate

2
推荐指数
1
解决办法
525
查看次数

角线不渲染子组件,而是渲染父组件

我想创建一个嵌套的路由movies/:id但是,使用我当前的配置,当用户导航到movies/1父组件时,始终会呈现。我需要MovieDetailComponentmovies/1url 上渲染。这是我的配置:

const routes: Routes = [{
    path: '',
    component: HomeView
  },
  {
    path: 'movies',
    component: MoviesView,
    children: [{
      path: ':id',
      component: MovieDetailComponent
    }]
  },
  {
    path: 'not-found',
    component: PageNotFoundComponent,
    pathMatch: 'full'
  },
  {
    path: '**',
    redirectTo: 'not-found'
  }
];
Run Code Online (Sandbox Code Playgroud)

我尝试过先添加pathMatch: 'full'到父组件,然后添加到子组件,然后再添加。当我添加pathMach: 'full'到父组件时,子URL甚至都不会被点击;当我将pathMatch: 'full'just 添加到子组件时,即使URL为,也只会呈现父组件。/movies/:id为什么会这样?

当我将子路径移动到其自己的路径中时(未嵌套),该组件将正确呈现。

const routes: Routes = [{
    path: '',
    component: HomeView
  },
  {
    path: 'movies',
    component: MoviesView
  },
  {
    path: …
Run Code Online (Sandbox Code Playgroud)

routing angular angular-router

1
推荐指数
1
解决办法
782
查看次数

为什么 EF 核心一对一关系没有按预期工作?

我有一个用户和一个 RefreshToken。我需要在这两个对象之间创建一对一的关系。我的 RefreshToken 对象看起来像这样

`public class RefreshToken
    {
        [ForeignKey("User")]
        public string RefreshTokenID { get; set; }
        public string UserId { get; set; }
        public User User { get; set; }
        public string Token { get; set; }
}`
Run Code Online (Sandbox Code Playgroud)

我的用户对象看起来像这样

`public class User : IdentityUser
  {
    public RefreshToken RefreshToken { get; set; }
}`
Run Code Online (Sandbox Code Playgroud)

以下是我如何使用 _refreshTokenRepository 为用户保留 RefreshToken:

`public async Task<bool> SaveAsync(User user, string newRefreshToken, CancellationToken ct = default(CancellationToken))
    {
      if(user.RefreshToken != null) return false;
      RefreshToken rt = new RefreshToken(newRefreshToken, DateTime.Now.AddDays(5), …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core asp.net-core-webapi

1
推荐指数
1
解决办法
1423
查看次数