![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
antd
superYe7
这个作者很懒,什么都没留下…
展开
-
a-select组件使用dropdownRender 时如果有a-input组件,点击a-input时select组件会收起,导致input无法输入
实现如图效果期望:点击输入框可以正常输入 下拉框不会收起,选择option时下拉框可以正常收起。思路:通过open控制select的收放。<template> <div @mousedown="e => { e.preventDefault() this.selectOpen = true }"> <a-select default-value="lucy" style="width: 300px" :open="se原创 2021-03-10 10:19:03 · 3621 阅读 · 2 评论 -
antd:upload图片上传时发现背景透明的图片上传后背景会变黑
排查出来是因为只有png格式支持透明,但是上传png格式图片时都被处理成jpg格式了,下面是问题代码:转二进制的时候强制设为了jpg格式找到了问题,但是如果直接用canvas.toDataURL().split(',')的话会默认使用png格式,上传jpg也会变成png,我们的目标是使用图片原来的格式beforeUpload = file => { ... ...原创 2020-01-09 16:38:43 · 2066 阅读 · 0 评论 -
一个FormItem中校验多个input
实现以下效果:将三个input封装成一个组件InputComp.js:import React, { Component } from 'react'import { Input } from 'antd'export default class InputComp extends Component { static getDerivedStateFromProps(n...原创 2019-10-10 16:14:41 · 5205 阅读 · 0 评论 -
react+antd:全局设置form表单不可编辑
在做编辑页面的时候遇到一个需求是“在指定状态下内容不可编辑”方案一:给每个<Input>、<Select>...添加disable属性这种方案在form表单内容比较多的情况下可能不是很方便,所以辜老师帮我想了方案二方案二:封装个组件全局设置disable,如下封装一个高阶组件( ./Input )import React, { useContext, ...原创 2019-08-29 20:07:56 · 16682 阅读 · 4 评论 -
在FormItem中使用select的initialValue设置初始值
<FormItem label="用户" {...formLayout}>{ getFieldDecorator('useredit', { initialValue: editUserId })( <Select mode="multiple" onChange={this.handle...原创 2019-04-26 16:05:40 · 9147 阅读 · 0 评论 -
react+antd:Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an uniqu
Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.Warning: [antd: Table] Each record in dataSource of table should have a unique `key` prop, or s...原创 2019-03-28 16:22:59 · 17643 阅读 · 7 评论 -
react+antd:在Form中使用Dropdown
在antd的官方实例中,一个简单的Dropdown是这样的render(){ const menu = ( <Menu> <Menu.Item> <a target="_blank" href="http://www.alipay.com/">1st menu item</a> ...原创 2019-03-27 10:06:15 · 3715 阅读 · 0 评论 -
react+antd:Form表单校验不提示错误信息
使用antd做表单的小伙伴一定经常会用到getFieldDecorator<FormItem label="用户名"> { getFieldDecorator('userName', { rules: [{ required: true, message: '用户名不能为空...原创 2019-03-29 14:48:10 · 19225 阅读 · 0 评论 -
react+antd:"key"prop警告
Warning: Each child in a list should have a unique "key" prop.根据warning定位找到425行的button,给它添加key值Warning: Each child in an array or iterator should have a unique "key" prop.主要出现在react的map回调时,添...原创 2019-03-25 19:48:18 · 2837 阅读 · 0 评论 -
react+antd:Form校验`getFieldDecorator`警告
Warning: `defaultValue` is invalid for `getFieldDecorator` will set `value`, please use `option.initialValue` instead.<FormItem label="等级"> {getFieldDecorator('grade', { rules: [{...原创 2019-03-25 19:40:45 · 2613 阅读 · 0 评论