我正在使用 Material UI 的 Switch 组件,我想在其中添加文本。我想要如下图所示的东西。
这是我的代码。
import React from 'react';
import Switch from '@material-ui/core/Switch';
export default function Switches() {
const [state, setState] = React.useState({
checkedA: true,
});
const handleChange = (event) => {
setState({ ...state, [event.target.name]: event.target.checked });
};
return (
<div>
<Switch
checked={state.checkedA}
onChange={handleChange}
name="checkedA"
inputProps={{ 'aria-label': 'secondary checkbox' }}
/>
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
我已经搜索了答案并找到了How to add text inside a Switch Component in Material-UI React? 并将文本添加到 Switch formcontrol 并使用 Material ui 在切换中更改它。他们两个对我都没有帮助。
我目前正在尝试在 Firebase 上创建数据库,但收到以下错误:
{"error":{"code":400,"message":"CONFIGURATION_NOT_FOUND","errors":[{"message":"CONFIGURATION_NOT_FOUND","domain":"global","reason":"invalid"}]}}
Run Code Online (Sandbox Code Playgroud)
我知道这是明智的,但我设置数据库的代码如下:
<script src="https://www.gstatic.com/firebasejs/8.3.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.3.1/firebase-firestore.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyAI6HD2Fa35nSL3wqT1u98TgdykPoU1Vvc",
authDomain: "todo-ca9f2.firebaseapp.com",
databaseURL: "https://todo-ca9f2-default-rtdb.firebaseio.com/",
projectId: "todo-ca9f2",
storageBucket: "todo-ca9f2.appspot.com",
messagingSenderId: "787961698428",
appId: "1:787961698428:web:c2af07085cdd3c9ab491f9",
measurementId: "G-SGPXZS4XET"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const auth = firebase.auth();
const db = firebase.firestore();
//firebase.analytics();
</script>
<script src="app.js"></script>
Run Code Online (Sandbox Code Playgroud)
如果我在 git 中使用基于 ID 的 GitHub 提供的 noreply 地址作为电子邮件和推送更改,我的贡献会被计算在内吗?
我的基于 ID 的 GitHub 提供的 noreply 地址如下所示ID+username@users.noreply.github.com
为什么namespace std用Turbo C ++ / Borland C ++编写的程序不需要名称空间std 时必须在新的编译器中使用?
这适用于旧的编译器
#include <iostream.h>
int main () {
cout << "Hello Programmers";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是我们必须在新的编译器中编写以下给定的程序,而不是在上面的程序中编写,因为上述程序在新的编译器中不起作用。
#include <iostream>
using namespace std;
int main () {
cout << "Hello Programmers";
return 0;
}
Run Code Online (Sandbox Code Playgroud) html ×2
javascript ×2
c++ ×1
css ×1
firebase ×1
git ×1
github ×1
material-ui ×1
namespaces ×1
reactjs ×1
std ×1
turbo-c++ ×1