Bootstrap(docs)说"总是试图将模态的HTML代码放在文档的顶层位置,以避免影响模态外观和/或功能的其他组件."
这是否意味着将模态放在我<body>
标签的最顶端?如果是这样,为什么?
来自React Router的文档:
a的所有孩子
<Switch>
应该是<Route>
或<Redirect>
元素.只会呈现与当前位置匹配的第一个子项.
尽管如此,<Switch>
允许使用嵌套语句.我用这个模式来分解大量的<Routes>
:
<Switch>
<Route path="/foo" component={FooRouter} />
<Route path="/bar" component={BarRouter} />
<Route path="/baz" component={BazRouter} />
</Switch>
...
const FooRouter = () => (
<Switch>
<Route exact path="/foo/:id" component={ViewFoo} />
<Route exact path="/foo/new" component={NewFoo} />
</Switch>
)
const BarRouter = () => (
<Switch>
<Route exact path="/bar/new" component={NewBar} />
</Switch>
)
....
Run Code Online (Sandbox Code Playgroud)
好奇是否有更好的方法来分解大量的路由,是否<Switch>
应该避免使用嵌套语句?
我使用Initializer快速生成HTML5 + Boostrap样板,并且好奇为什么创建的HTML文档没有开始<html>
标记?
这是Initializr为我生成的顶部部分:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
Run Code Online (Sandbox Code Playgroud)
我使用Initializr部署了一些网站,并没有遇到问题.你需要开口<html>
标签吗?
我正在将第一代Cloud Firestore 触发器迁移到第二代。
但是,我不知道如何从第二代 Cloud Trigger 中访问 Google 的 Secret Manager。
存在通过使用传递到函数的依赖项数组中的实用程序来访问第二代云函数中的机密的文档。defineSecret
但是,此方法不适用于第二代云触发器,因为没有选项参数来传递依赖项数组。
用一个片段来解释我正在尝试做的事情:
import { onDocumentCreated } from 'firebase-functions/v2/firestore';
import { defineSecret } from 'firebase-functions/params';
const apiKey = defineSecret('API_KEY');
const onUserCreated = onDocumentCreated(
'users/{userId}',
async (event) => {
// access apiKey secret
}
);
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。谢谢。
firebase google-cloud-functions google-cloud-firestore google-secret-manager