我正在尝试制作一个日历,当我单击其中一个日期时,会弹出一个您必须填写的表格。我无法使其正常工作。我唯一能上班的是第一个“1”约会。其他一切都不起作用,我不知道如何解决它。我尝试重写代码并切换到 id,但没有任何效果。任何帮助表示赞赏。谢谢!
document.querySelector(".weekdays").addEventListener("click",
function() {
document.querySelector(".bg-modal").style.display = "flex";
});Run Code Online (Sandbox Code Playgroud)
.bg-modal {
width: 100%;
background-color: rgba(0, 0, 0, .7);
height: 100vh;
position: fixed;
z-index: 20;
display: none;
}
.modal-content {
width: 30%;
height: 50%;
position: absolute;
top: 50%;
border-radius: 30px;
background: linear-gradient(to bottom, #2ad6ff, #0069ff);
}
.modal-heading {
width: 70%;
height: 50px;
position: absolute;
border-radius: 50px;
background-color: #2ad6ff;
left: 50%;
transform: translate(-50%);
top: -6%;
font-size: 32px;
text-align: center;
color: white;
}
.modal-close {
position: absolute;
transform: rotate(45deg);
font-size: 42px;
color: white; …Run Code Online (Sandbox Code Playgroud)我正在将一个对象作为道具传递给组件。
\n\n<SomeComponent myData={props.myData}>...</SomeComponent>\nRun Code Online (Sandbox Code Playgroud)\n\n在 中SomeComponent,当 I 时console.log this.props.myData,它不是未定义的并且包含key/val对,如预期的那样。
constructor(props) {\n super(props);\n console.log(this.props.myData);\n \xe2\x80\xa6\n}\nRun Code Online (Sandbox Code Playgroud)\n\n\n\n但是,当我尝试访问该对象的任何一个属性时,它们都是undefined.
constructor(props) {\n super(props);\n console.log(this.props.myData.title); // undefined\n \xe2\x80\xa6\n}\nRun Code Online (Sandbox Code Playgroud)\n\n更新
\n\n以下确实输出了该值,但我不清楚为什么,因为该对象已经可用而无需setTimeout.
constructor(props) {\n super(props);\n setTimeout(() => {\n console.log(this.props.fightData.title); // "Work plain near killed us both"\n });\n \xe2\x80\xa6\n}\nRun Code Online (Sandbox Code Playgroud)\n What does % indicate in scss?
Use of % in context: (source: https://codepen.io/FWeinb/pen/GrpqB?editors=1100)
@import "compass/css3";
.box{
margin: 5em auto;
position: relative;
width: 10em;
height: 10em;
line-height: 10em;
overflow: hidden;
}
%box__dir{
position: absolute;
width: inherit;
height: inherit;
text-align: center;
line-height: inherit;
transition:transform .4s ease;
}
Run Code Online (Sandbox Code Playgroud)
What does the percentage sign before "box_dir" indicate?
我正在尝试在功能组件中呈现页脚项目的列表。
这是我的数据:
export const footerLinks = [{
"title": "Learn More",
"data": [{
id: 'news',
name: 'News',
to: '/news'
},
{
id: 'faq',
name: 'FAQ',
to: '/faq'
}
]
},
{
"title": "Media",
"data": [{
id: 'media',
name: 'Media Kit',
to: '/media'
},
{
id: 'media_enquiries',
name: 'Media Enquiries',
to: '/media_enquiries'
}
]
}]
Run Code Online (Sandbox Code Playgroud)
我导入数据并尝试将其输出到中<ul>。将console.log在MyListItems功能确实输出的预期值。但是,在forEach日志listItems显示之后,它是undefined且只有一个空白<ul></ul>使其进入屏幕。
有什么想法吗?
import { footerLinks } from '../site'
function MyListItems() { …Run Code Online (Sandbox Code Playgroud)