我的需要是获取该视频文件的持续时间或时间长度。所以我做了 console.log(videoFile.duration)
,但是它的显示undefined
&为什么它显示未定义?那么如何在React js 中获取视频时长...
const VideoList = ({ videoFile }) => {
console.log(videoFile.duration);
// output ==> undefined
return (
<div className="relative">
<video src={videoFile} className="w-full pb-2 sm:w-32 sm:pb-0 rounded mr-2" />
<span className="absolute bottom-1 right-3 bg-black/60 text-white rounded px-1.5">0:00</span>
</div>
);
}
export default VideoList;
Run Code Online (Sandbox Code Playgroud) 通过将鼠标悬停在文本 ::after 伪类内容将可见,但仅通过查看或测试,我不会通过这种方法在 tailwind-css 中使用 .map 内的 react-js 在浏览器中打印该文本内容()
const data = [
"Web Design",
"Development",
"Illustration",
"Product Design",
"Social Media",
];
Run Code Online (Sandbox Code Playgroud)
<ul className='flex flex-col gap-5 text-[85px]'>
{
data.map(item =>
<li
key={item}
className={`cursor-pointer relative
after:content-['${item}'] <----- this approach is not working...! Why?
after:absolute
after:right-0
after:text-red-200 `}
>
{item}
</li>
)
}
</ul>
Run Code Online (Sandbox Code Playgroud)
虽然我也尝试这种方法......
after:content-[${item}]
Run Code Online (Sandbox Code Playgroud)