我正在尝试使用 React Native 和 Expo 中的电子邮件链接通过 Firebase 进行身份验证。这是我的代码
const actionCodeSettings = {
url: 'ndimensions-9c677.web.app',
handleCodeInApp: true,
};
emailAuth: async (email) => {
try {
firebase.auth().sendSignInLinkToEmail(email, actionCodeSettings)
.then(() => {
// The link was successfully sent. Inform the user.
// Save the email locally so you don't need to ask the user for it again
// if they open the link on the same device.
window.localStorage.setItem('emailForSignIn', email);
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message; …
Run Code Online (Sandbox Code Playgroud) 我正在尝试更新输入值。它工作正常,正在更新其值。但是,有一个问题,当它更新其值时,它会从数字转换为字符串。我已经尝试过Number、parseInt,但它不起作用。它总是转换为字符串。
import React from 'react';
import useForm from '../lib/useForm';
const CreateProduct = () => {
const { input, handleChange } = useForm({
name: 'mama',
price: 0,
});
return (
<form>
<label htmlFor="price">
Price
<input
type="number"
id="price"
name="price"
placeholder="Price"
value={parseInt(input.price)}
onChange={handleChange}
/>
</label>
</form>
);
};
export default CreateProduct;
Run Code Online (Sandbox Code Playgroud)
在自定义函数中:
import * as React from 'react';
export default function useForm(initialValue = {}) {
const [input, setInput] = React.useState(initialValue);
function handleChange(event) {
const { name, value } = …
Run Code Online (Sandbox Code Playgroud) 在 Python 3+ 中,我试图运行turtle.setup(400, 500)
但它不起作用。
没有名为 的引用setup
。
如何在 Python 3 中使用屏幕设置?
我正在尝试绘制一个如下所示的条形图,我不确定如何在每列顶部设置百分比值,并在右侧设置图例。我的代码片段如下。它正在工作,但是缺少百分比值和图例。
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
objects = ('18-25', '26-30', '31-40', '40-50')
y_pos = np.arange(len(objects))
performance = [13, 18, 16, 3]
width = 0.35 # the width of the bars
plt.bar(y_pos, performance, align='center', alpha=0.5, color=('red', 'green', 'blue', 'yellow'))
plt.xticks(y_pos, objects)
plt.ylabel('%User', fontsize=16)
plt.title('Age of Respondents', fontsize=20)
width = 0.35
plt.show()
Run Code Online (Sandbox Code Playgroud)
python ×2
bar-chart ×1
expo ×1
firebase ×1
javascript ×1
matplotlib ×1
python-3.x ×1
react-hooks ×1
react-native ×1
reactjs ×1