小编Kun*_*dan的帖子

使用 Material ui 在开关内添加文本

我正在使用 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 在切换中更改它。他们两个对我都没有帮助。

html javascript reactjs material-ui

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

Firebase 代码 400“消息”:“CONFIGURATION_NOT_FOUND”

我目前正在尝试在 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)

我在图像上的代码中调用 Firebase: 在此输入图像描述

html javascript css firebase firebase-realtime-database

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

我可以在git中使用基于ID的GitHub提供的noreply地址吗?

如果我在 git 中使用基于 ID 的 GitHub 提供的 noreply 地址作为电子邮件和推送更改,我的贡献会被计算在内吗?

我的基于 ID 的 GitHub 提供的 noreply 地址如下所示ID+username@users.noreply.github.com

git github

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

为什么在新的IDE中必须使用命名空间std,而用Turbo C ++ / Borland C ++编写的程序却不需要命名空间std?

为什么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)

c++ namespaces std turbo-c++

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