0

当我定义完Upload.Dragger组件的accept属性,这时候这个组件不能够拖拽上传文件

<Upload.Dragger
            multiple
            listType="picture"
            accept="application/xml"
            beforeUpload={file => {
              this.setState(state => ({
                importFileList: [...state.importFileList, file],
              }));
              return false;
            }}
            onRemove={file => {
              this.setState(state => {
                const index = state.importFileList.indexOf(file);
                const newFileList = state.importFileList.slice();
                newFileList.splice(index, 1);
                return {
                  importFileList: newFileList,
                };
              });
            }}
          >
            <p className="ant-upload-drag-icon">
              <Icon type="inbox" />
            </p>
            <p className="ant-upload-text">{formatMessage({ id: '点击或将文件拖拽到这里上传' })}</p>
            <p className="ant-upload-hint">
              {formatMessage({ id: '支持扩展名' })}: {`${type}` === '1' ? '.xml' : '.xlsx'}
            </p>
          </Upload.Dragger>
lius 3
2019-01-24 提问
0 个回答

撰写答案

你可能感兴趣的

推广链接