小编Fre*_*nga的帖子

如何使用 NextJS 将我的 URL 与应用程序状态同步

我有适合我的应用程序的过滤器。我想要进行浅层路由,并在用户更改过滤器时将查询添加到 URL,同时更新我的​​应用程序状态。然而,这似乎是我维持着两种状态。有这方面的最佳实践吗?我希望我的 URL 与应用程序状态相匹配。

reactjs next.js

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

如何更改React Material UI上的Stepper颜色?

在此输入图像描述

在上面的屏幕截图中,我试图将步骤颜色更改为:绿色表示正确,黄色表示正在进行,红色表示不正确.

我怎么能这样做?

reactjs material-ui

6
推荐指数
5
解决办法
9196
查看次数

反应路由器activeClassName没有为子路由设置活动类

<ul className="right hide-on-med-and-down">
  <li><IndexLink to="/" activeClassName="active">ABOUT</IndexLink></li>
  <li><Link to="blog" activeClassName="active">BLOG</Link></li>
  <li><Link to="discover" activeClassName="active">DISCOVER</Link></li>
  <li><Link to="contact" activeClassName="active">CONTACT</Link></li>
 </ul>
Run Code Online (Sandbox Code Playgroud)

这就是我的导航样子,当我导航到/ blog时,博客处于活动状态。但是,当我导航到/ blog / my-blog-post时,活动类消失了,有没有办法使/ blog / my-blog-post在我的博客列表项上设置活动类?

javascript reactjs react-router

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

PlatformException(popup_blocked_by_browser,从 GoogleAuth.signIn() 引发的异常

PlatformException(popup_blocked_by_browser, Exception raised from GoogleAuth.signIn()当我尝试使用 google_sign_in flutter 包通过 Google 登录时,我不断地进行 每一次尝试。只有当我使用 Safari 时才会出现这种情况,在 chrome 上没问题。我想知道为什么它在第一次尝试时失败,但在之后的尝试中有效。如果我刷新浏览器,第一次尝试就会再次失败。

这是我使用 firebase auth 和 google 登录的功能

@override
  Future<auth.User?> signInWithGoogle() async {
    final GoogleSignInAccount? googleUser =
        await _googleSignIn.signInSilently();
    final GoogleSignInAuthentication? googleAuth =
        await googleUser?.authentication;

    if (googleAuth == null) {
      return null;
    }

    final AuthCredential credential = GoogleAuthProvider.credential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );

    final UserCredential userCredential =
        await _firebaseAuth.signInWithCredential(credential);

    return auth.User(
      uid: userCredential.user?.uid,
      email: userCredential.user?.email,
    );
  }
Run Code Online (Sandbox Code Playgroud)

safari google-signin flutter googlesigninaccount flutter-web

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

Firebase 规则拒绝集合组查询

有用户、项目作为顶级集合,任务作为项目的子集合,下面是安全规则,我在允许集合组查询任务时遇到问题。即使我删除对createdBy的检查,似乎也不起作用,当我为任务资源运行模拟器时,我的规则有效

match /projects/{projectID} {
  allow read, delete, update: if request.auth.uid == resource.data.createdBy;
  allow create: if request.auth != null;
}

match /users/{userID} {
    allow read, delete, update: if request.auth.uid == userID;
  allow create: if request.auth != null;
}

match /projects/{projectID}/tasks/{taskID} {
  allow read, delete, update: if request.auth.uid == resource.data.createdBy;
  allow create: if request.auth != null;
}
Run Code Online (Sandbox Code Playgroud)

这是我的集合组查询

_firestore
    .collectionGroup('tasks')
    .where('dueDate', isEqualTo: DateTimeHelper.today)
    .where('createdBy', isEqualTo: user.id)
    .snapshots()
    .map((list) => list.documents.map((doc) {
          String projectId = doc.reference.parent().parent().documentID;
          String taskId = doc.documentID;
          return Task.fromDocument(doc, taskId, …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-security google-cloud-firestore

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

ng-pattern regex错误:[$ parse:lexerr] Lexer错误

我有这个作为我的正则表达式模式

(^([Aa][Ss])[0-9]{8})|(^6[0-9]{7})
Run Code Online (Sandbox Code Playgroud)

我在下面收到控制台错误,但可以正常工作!:

libraries-c8d65edf41.js:22505 Error: [$parse:lexerr] Lexer Error: Unexpected next character  at columns 1-1 [^] in expression [(^([Aa][Ss])[0-9]{8})|(^6[0-9]{7})].
Run Code Online (Sandbox Code Playgroud)

http://errors.angularjs.org/1.5.2/ $ parse / lexerr?p0 = Unexpected%20nextharacter%20&p1 = s%201-1%20%5B%5E%5D&p2 =(%5E(%5BAa%5D% 5BSs%5D)%5B0-9%5D%7B8%7D)%7C(%5E6%5B0-9%5D%7B7%7D)

关于如何摆脱控制台错误的任何想法?谢谢。

这是指令html

<div class="input">
<div data-ng-class="{'input-group': label}">
    <div class="input-group-addon"
        data-ng-if="label">
        {{label}}
        <span class="required"
            data-ng-if="required && isEditable">
            *
        </span>
    </div>
    <div class="input-group-addon required"
        data-ng-if="!label && required && isEditable">
        *
    </div>
    <div class="form-control"
        title="{{object[key] || 'N/A'}}"
        data-ng-if="!isEditable">
        <span>{{object[key] || 'N/A'}}</span>
    </div>
    <div class="form-control editable"
        title="{{object[key] || 'N/A'}}"
        data-ng-if="isEditable && !isEditing"
        data-ng-click="edit()">
        <span>
            <a …
Run Code Online (Sandbox Code Playgroud)

javascript regex angularjs ng-pattern angularjs-ng-pattern

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

如何使用 flutter HookWidget 访问 didChangeAppLifecycleState 生命周期钩子中的 Context?

我正在尝试访问上下文,以便可以读取我的提供程序,但由于此生命周期挂钩位于小部件树之外。它无法访问。有没有办法访问上下文?

flutter flutter-dependencies flutter-layout

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