首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何从数组中呈现图像

如何从数组中呈现图像
EN

Stack Overflow用户
提问于 2020-11-01 02:25:10
回答 1查看 84关注 0票数 0

我的web应用程序不能从我的对象数组中渲染图像。我尝试了require方法,但没有成功。这是我的文件夹结构

我的数组现在看起来像这样。我不知道是不是文件夹路径错了,但它看起来相对正确,所以如果我需要以某种方式使用require方法,如何更改我的路径名

代码语言:javascript
运行
复制
export const Projects = [
    {
        id: "intuition",
        name: "inTuition website",
        tags: ["Financial Markets", "Express", "Mongo DB"],
        description: "Team App was a concept project for a team communication website. I made it through Webflow and took advantage of their powerful CMS platform to create a blog section that management can update on their timeline without a developer. This Application is fully responsive and highlights the foundational principles behind a reliable website for a growing company.",
        pageDescription: "Intuition is an online global money transfer application for international students who want a faster, and more secure way to transfer money from their home nation to their school. inTuition is commited to developing inovative technologies that make the global financial markets more convinient for end users.",
        thumbnail: '../pages/images/team2.png',
        mockup: '../pages/images/team-fs.jpg',
        link: '/experience/intuition'
    },
    {
        id: "savona",
        name: "Savona website",
        tags: ["Restaurant", "Webflow", "Content-Management-System"],
        description: "Savona is a local pizza restaurant in Calgary that serves the most delicious pizza, and I am excited to build their first website. I designed a modern website that reenforces Savona's culture, brand and identity. I integrated a robust online ordering process using moduurn to enable customers to order online and add a new avenue of revenue for the company",
        pageDescription: "Savona is a local pizza restaurant in Calgary that serves the most delicious pizza, and I am excited to build their first website. I designed a modern website that reenforces Savona's culture, brand and identity. I integrated a robust online ordering process using moduurn to enable customers to order online and add a new avenue of revenue for the company",
        thumbnail: "../pages/images/savona-thumbnail.png",
        mockup: '../pages/images/savona.png',
        link: '/experience/savona'
    },
    {
        id: "teamapp",
        name: "Team App website",
        tags: ["Concept", "Responsive", "Blog"],
        description: "Team App was a concept project for a team communication website. I made it through Webflow and took advantage of their powerful CMS platform to create a blog section that management can update on their timeline without a developer. This Application is fully responsive and highlights the foundational principles behind a reliable website for a growing company.",
        pageDescription: "Team App was a concept project for a team communication website. I made it through Webflow and took advantage of their powerful CMS platform to create a blog sect",
        thumbnail: '../pages/images/team2.png',
        mockup: '../pages/images/team-fs.jpg',
        link: '/experience/teamapp'
    }
]

动态呈现它的页面如下所示

代码语言:javascript
运行
复制
import React from "react";
import Footer from '../components/Footer'
import Navbar from '../components/Navbar'
import { Projects } from '../Database/Projects'


export default function ExperiencePage({ match }) {
    function expPlace(exp) {
        return exp.id === match.params.id
    }

    const place = Projects.find(expPlace)

    return (
        <div>
            <div class="header">
                <Navbar />
                <div class="header-wrapper">
                    <div class="container center">
                        <h4>project showcase</h4>
                        <h1>{place.id}</h1>
                        <p class="header-paragraph">{place.pageDescription}</p>
                        {/* <a href="#" class="live-site-link yellow-link">visit live site →</a> */}
                    </div>
                </div>
            </div>
            <div class="section">
                <div class="screen-container">
                    <img alt="A screenshot of web page" src={place.mockup} class="screen-image" />
                </div>
            </div>
            <Footer />
        </div>
    )
}
EN

回答 1

Stack Overflow用户

发布于 2020-11-01 08:40:15

i found this it may help

尝试像mockup: require('../pages/images/savona.png'),一样将require放到projects

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64625102

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档