RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-328211

Егор Гришин's questions

Martin Hope
Егор Гришин
Asked: 2020-12-06 18:32:44 +0000 UTC

做出反应。国家的崛起[关闭]

  • -4
关闭。这个问题需要澄清或补充细节。目前不接受回复。

想改进这个问题?通过编辑此帖子添加更多详细信息并澄清问题。

2年前关闭。

改进问题

棘手的问题。功能组件中是否可以进行状态提升。

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Егор Гришин
Asked: 2020-11-22 23:06:40 +0000 UTC

更改对象数组中对象的状态。反应

  • 0

从数据库接收到一定的字段数组。这些字段被传递给组件以在表中创建一个项目。每个字段都包含一个名称,例如“电话”或“地址”。这样做是为了在添加新项目时,它会在创建时相应地显示。此外,根据接收到的字段,创建输入(s),我需要从每个输入(a)中收集一个值并将其放入对象数组中。我想出的高潮是:

onChange={({ target }) => {
  const { name, value } = target

  setQuery(query => ({
    ...query,
    fields: [
      ...query.fields,
      {
        name,
        value
      }
    ]
  }))
}}

结果在哪里

fields: (23) […]
​​
0: Object { name: "Телефон", value: "ы" }
​​
1: Object { name: "Телефон", value: "ыа" }
​​
2: Object { name: "Телефон", value: "ыау" }
​​
3: Object { name: "Телефон", value: "ыауы" }
​​
4: Object { name: "Телефон", value: "ыауыу" }
​​
5: Object { name: "Телефон", value: "ыауыуа" }
​​
6: Object { name: "Адрес", value: "ф" }
​​
7: Object { name: "Адрес", value: "фы" }
​​
8: Object { name: "Адрес", value: "фыа" }
​​
9: Object { name: "Адрес", value: "фыаф" }
​​
10: Object { name: "Адрес", value: "фыафы" }
​​
11: Object { name: "Адрес", value: "фыафыа" }
​​
12: Object { name: "Адрес", value: "фыафыау" }
​​
13: Object { name: "Почта", value: "ф" }
​​
14: Object { name: "Почта", value: "фы" }
​​
15: Object { name: "Почта", value: "фыа" }
​​
16: Object { name: "Почта", value: "фыаф" }
​​
17: Object { name: "Почта", value: "фыафы" }
​​
18: Object { name: "Почта", value: "фыафыу" }
​​
19: Object { name: "Почта", value: "фыафыуа" }
​​
20: Object { name: "Почта", value: "фыафыуаы" }
​​
21: Object { name: "Почта", value: "фыафыуаыу" }
​​
22: Object { name: "Почта", value: "фыафыуаыуа" }

没有更多的力量了。帮助!

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Егор Гришин
Asked: 2020-09-16 23:09:50 +0000 UTC

做出反应。旋转木马

  • 0

学习React,决定设计自己的自行车(carousel),在连接handler的过程中,遇到了一个难以理解的情况。当我们以混乱的顺序按下幻灯片更改按钮时,幻灯片会在一张,然后是两张,以此类推。告诉我可能是什么原因。我认为这很可能是 setState() 方法。

export default class HeroCarousel extends Component {
  
  state = {
    slides: [
      {
        caption: {
          title: 'Slide one',
          text: `Lorem ipsum dolor sit amet, malorum recteque reprehendunt ea vel. 
          Urbanitas adolescens vim te, per at tritani aperiri. Adhuc invenire convenire his ea.`,
        },
        bg: 'images/content/hero_carousel/slides/img.jpg',
      },
      {
        caption: {
          title: 'Slide two',
          text: `Lorem ipsum dolor sit amet, malorum recteque reprehendunt ea vel. 
          Urbanitas adolescens vim te, per at tritani aperiri. Adhuc invenire convenire his ea.`,
        },
        bg: 'images/content/hero_carousel/slides/img1.jpg',
      },
      {
        caption: {
          title: 'Slide three',
          text: `Lorem ipsum dolor sit amet, malorum recteque reprehendunt ea vel. 
          Urbanitas adolescens vim te, per at tritani aperiri. Adhuc invenire convenire his ea.`,
        },
        bg: 'images/content/hero_carousel/slides/img2.jpg',
      },
      {
        caption: {
          title: 'Slide four',
          text: `Lorem ipsum dolor sit amet, malorum recteque reprehendunt ea vel. 
          Urbanitas adolescens vim te, per at tritani aperiri. Adhuc invenire convenire his ea.`,
        },
        bg: 'images/content/hero_carousel/slides/img3.jpg',
      },
      {
        caption: {
          title: 'Slide five',
          text: `Lorem ipsum dolor sit amet, malorum recteque reprehendunt ea vel. 
          Urbanitas adolescens vim te, per at tritani aperiri. Adhuc invenire convenire his ea.`,
        },
        bg: 'images/content/hero_carousel/slides/img4.jpg',
      },
      {
        caption: {
          title: 'Slide six',
          text: `Lorem ipsum dolor sit amet, malorum recteque reprehendunt ea vel. 
          Urbanitas adolescens vim te, per at tritani aperiri. Adhuc invenire convenire his ea.`,
        },
        bg: 'images/content/hero_carousel/slides/img5.jpg',
      },
    ],
    breadcrumbs: [
      {
        previewImage: 'images/content/hero_carousel/breadcrumbs/img.jpg',
        ariaLabel: 'Example breadcrumb',
      },
      {
        previewImage: 'images/content/hero_carousel/breadcrumbs/img1.jpg',
        ariaLabel: 'Example breadcrumb',
      },
      {
        previewImage: 'images/content/hero_carousel/breadcrumbs/img2.jpg',
        ariaLabel: 'Example breadcrumb',
      },
      {
        previewImage: 'images/content/hero_carousel/breadcrumbs/img3.jpg',
        ariaLabel: 'Example breadcrumb',
      },
      {
        previewImage: 'images/content/hero_carousel/breadcrumbs/img4.jpg',
        ariaLabel: 'Example breadcrumb',
      },
      {
        previewImage: 'images/content/hero_carousel/breadcrumbs/img5.jpg',
        ariaLabel: 'Example breadcrumb',
      },
    ],
    position: 0,
  }


  goToNextSlide = () => {
    let {
      position,
      slides
    } = this.state;

    if (position === slides.length - 1) {
      position = 0 
    }

    ++position

    return this.setState({
      position: position
    })
  }

  goToPrevSlide = () => {
    let {
      position,
      slides
    } = this.state;

    if (position === 0) {
      position = slides.length - 1 
    }

    --position

    return this.setState({
      position: position
    })
  }

  render() {
    return (
      <div className="carousel" id="hero-carousel">

        {/* Begin control next*/}
        <HeroCarouselControlRight handler={this.goToNextSlide} />
        {/* End control next transform ease-out 450ms */}

        {/* Begin control previous*/}
        <HeroCarouselControlLeft handler={this.goToPrevSlide} />
        {/* End control previous */}

        <div className="carousel__inner" style={{
          transition: 'transform ease-out 450ms', 
          transform: `translateX(-${this.state.position}00%)`
        }}>
          {this.state.slides.map((slide, index) => 
            <HeroCarouselSlide 
              title={slide.caption.title}
              text={slide.caption.text}
              key={index}
              bg={slide.bg}
            />
          )}
        </div>

        <ul className="carousel__thumbs">
          {this.state.breadcrumbs.map((breadcrumb, index) =>
            <HeroCarouselBreadCrumb 
              previewImage={breadcrumb.previewImage}
              dataSlideTo={index}
              ariaLabel={breadcrumb.ariaLabel}
              handler={this.goToSlide}
              key={index}
            />
          )}
        </ul>
      </div>
    )
  }
}

reactjs
  • 1 个回答
  • 10 Views
Martin Hope
Егор Гришин
Asked: 2020-09-09 19:48:56 +0000 UTC

做出反应。成分

  • 0

在学习 react 的时候,我在 react-bootstrap 中发现了一个有趣的设计:

<Nav
  activeKey="/home"
  onSelect={selectedKey => alert(`selected ${selectedKey}`)}>
  <Nav.Item>
    <Nav.Link href="/home">Active</Nav.Link>
  </Nav.Item>
  <Nav.Item>
    <Nav.Link eventKey="link-1">Link</Nav.Link>
  </Nav.Item>
  <Nav.Item>
    <Nav.Link eventKey="link-2">Link</Nav.Link>
  </Nav.Item>
  <Nav.Item>
    <Nav.Link eventKey="disabled" disabled>
      Disabled
    </Nav.Link>
  </Nav.Item>
</Nav>

什么是 Nav.Item,我在哪里可以了解它?

javascript
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5