你好Stackoverflow用户!
我再次需要你的帮助.
我试图将4颗钻石放在一个页面的中心,作为登陆页面上的导航.4颗钻石应该让它们成为自己的钻石,我真的想不出怎么做.
我已经尝试过绝对的位置,但随后它的反应灵敏.
我在这个网站上有自举,所以也许有一个列的解决方案?我试过一切请帮忙.
.diamond-top {
position: absolute;
top: 25%;
left: 39%;
}
.diamond-left {
position: absolute;
left: 30%;
top: 38%;
}
.diamond-right {
position: absolute;
left: 48%;
top: 38%;
}
.diamond-bottom {
position: absolute;
top: 51%;
left: 39%;
}
.diamond-container {
width: 212px;
height: 212px;
padding: 30px;
}
.diamond-container:hover .tile-link {
-webkit-animation: rotateYaxis 5s linear infinite;
}
.tile-link {
font-size: 20px;
text-transform: uppercase;
text-align: center;
width: 150px;
height: 150px;
display: block;
position: relative;
line-height: 150px;
-webkit-transition: 1s ease-in-out; …Run Code Online (Sandbox Code Playgroud)React Typescript 阻止我使用emailJS的样板代码。
我修改了样板代码以修复 UseRef() 和 const sendEmail 上的一个错误。
我在函数 sendForm() 的 form.current 行上收到错误。
错误:(属性)React.RefObject.current:HTMLFormElement | 无效的
'HTMLFormElement | 类型的参数 null' 不可分配给'string | 类型的参数 HTMLFormElement'。类型“null”不可分配给类型“string |” HTMLFormElement'.ts(2345)
import React, { useRef } from 'react';
import emailjs from '@emailjs/browser';
export const ContactUs = () => {
const form = useRef<HTMLFormElement>(null);
const sendEmail = (e) => {
e.preventDefault();
emailjs.sendForm('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', form.current, 'YOUR_PUBLIC_KEY')
.then((result) => {
console.log(result.text);
}, (error) => {
console.log(error.text);
});
};
return (
<form ref={form} onSubmit={sendEmail}>
<label>Name</label>
<input …Run Code Online (Sandbox Code Playgroud)