小编Osc*_*olo的帖子

我不断收到错误 firebase.database 不是函数

我正在尝试将投资组合网站中的联系表单链接到 firebase 并继续在我的控制台中获取 (firebase.database 不是函数)

这是针对网络的,使用纯 javascript

var firebaseConfig = {
  apiKey: "AIzaSyCzX3r8CFw84WSBuCSXR1fWM_hDrwtGMSs",
  authDomain: "portfolio-4c243.firebaseapp.com",
  databaseURL: "https://portfolio-4c243.firebaseio.com",
  projectId: "portfolio-4c243",
  storageBucket: "",
  messagingSenderId: "745737502175",
  appId: "1:745737502175:web:a26e5b0baa3769c9"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);


var messagesRef = firebase.database().ref('messages');


document.getElementById('contactForm').addEventListener('submit', submitForm);

function submitForm(e) {
  e.preventDefault();

  var name = getInputVal('name');
  var email = getInputVal('email');
  var message = getInputVal('message');

  saveMessage(name, email, message);


}

// Function get value
function getInputVal(id) {
  return document.getElementById(id).value;
}

//Save
function saveMessage(name, email, message) {
  var newMessageRef = messagesRef.push();
  newMessageRef.set({
    name: name,
    email: …
Run Code Online (Sandbox Code Playgroud)

javascript contact-form firebase firebase-realtime-database

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

无法在 Python 3.10 上安装 Matplotlib

python3.10 -m pip install --user matplotlib
Run Code Online (Sandbox Code Playgroud)

当我运行上面的命令来安装 Matplotlib 时,我不断收到以下错误。我最初遇到 C++ 错误,然后我安装了 Visual Studio。

Time Elapsed 00:00:00.36
    error: command 'C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1:
'C:\Users\HP\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\HP\\AppData\\Local\\Temp\\pip-install-zq_i4lrq\\matplotlib_ce44358747c74e83a93eefbdd122f13e\\setup.py'"'"'; __file__='"'"'C:\\Users\\HP\\AppData\\Local\\Temp\\pip-install-zq_i4lrq\\matplotlib_ce44358747c74e83a93eefbdd122f13e\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\HP\AppData\Local\Temp\pip-record-yvrkad5m\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Include\matplotlib'
Check the logs for full command output.
Run Code Online (Sandbox Code Playgroud)

python matplotlib

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