ant-design-pro

Antd library: How to approach when trying to render an image?

走远了吗. 提交于 2020-05-17 14:47:16
问题 How to approach when trying to render an image? I am trying below but its not showing image. const columns = [ { title: 'image', dataIndex: 'notificationImage.url', key: 'notificationImage.url', render: (record) => //console.log(text, record && record.notificationImage && record.notificationImage.url, index) { record && record.notificationImage && <img width="460" height="345" src={record.notificationImage.url} /> } },] 回答1: I think your code block should look like this : Add return render:

Antd library: How to approach when trying to render an image?

喜夏-厌秋 提交于 2020-05-17 14:44:18
问题 How to approach when trying to render an image? I am trying below but its not showing image. const columns = [ { title: 'image', dataIndex: 'notificationImage.url', key: 'notificationImage.url', render: (record) => //console.log(text, record && record.notificationImage && record.notificationImage.url, index) { record && record.notificationImage && <img width="460" height="345" src={record.notificationImage.url} /> } },] 回答1: I think your code block should look like this : Add return render:

Reset Radio.Group values onSubmit click for antd library

随声附和 提交于 2020-05-17 06:31:06
问题 I am using ant-design library. There is useForm() hook to reset values. All values are being reset to original values but not for Radio.Group. How do I reset my radio button state to priority value from State? const [priority, setPriority] = useState(2); const [form] = Form.useForm(); const onSubmit = (values) => { console.log('Received values of form: ', values); form.resetFields(); } <Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" initialValues={{ size

How to dynamically set a required rule to the Form.Item validation

眉间皱痕 提交于 2020-01-25 02:45:06
问题 I have a list of parameters that may be checked or not. Its correspondent fields are enabled/disabled in dependence of checkbox state. So I want to enable and validate field if parameter is checked, and disable field and turn off validation rule while checkbox is unchecked. But I can't switch required rule to false while toggling checkbox. As you see the registrations parameter is unchecked but the field still have a validation.. Here is how I've done it: <Row key={index} gutter={8}> <Col

Ant Design : getFieldDecorator()

柔情痞子 提交于 2020-01-06 07:59:09
问题 import { Form, Input, Tooltip, Icon } from 'antd'; import React , {Component }from 'react'; import ReactDOM from 'react-dom'; export default class RegistrationForm extends Component { state = { confirmDirty: false, autoCompleteResult: [], }; handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { console.log('Received values of form: ', values); } }); } handleConfirmBlur = (e) => { const value = e.target.value; this.setState({

How to change Step number with Loading Icon in ReactJS

做~自己de王妃 提交于 2020-01-05 04:00:11
问题 I am working on project in reactjs, Currently I am using Ant-design for Wizard form. I will share ant-design link. I want to change step number with loading icon when user click on next.. The current step number ( for example 1 ) is changed to loading and proceed to next step . I am beginner could you please help me ? Ant-Design Link: Ant-design 回答1: This can be done by using steps custom icon property. The idea is you can pass the key in steps as given below: const steps = [ { title: "First"

How to preview a video in ReactJS

旧城冷巷雨未停 提交于 2019-12-20 04:09:45
问题 I am working on project in ReactJS, Currently I am using ant-design for file uploading. I want to preview video when user select a video . I am new to reactjs and unable to complete my task. Could someone please help me how it would be possible to preview a video . I will share my code with you You may check my code . Thanks Code import React from 'react'; import styled from 'styled-components'; import 'antd/dist/antd.css'; import './styletwo.css'; import { Form, Upload, Button, Icon } from