1 | import React from "react";
|
2 | import { Popover, Button } from "antd";
|
3 | import Download from "ynw/antd/Download";
|
4 | import { FilePptOutlined } from "@ant-design/icons";
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export default function ShowMulFile({ files, showCount = false }) {
|
13 | const values = files || [];
|
14 | const len = values.length;
|
15 |
|
16 | if (len < 1) return "--";
|
17 |
|
18 | const Content = () => {
|
19 | return (
|
20 | <div>
|
21 | {values.map(path => (
|
22 | <div key={path}>
|
23 | <Download src={path}>{path.replace(/^.+\//g, "")}</Download>
|
24 | </div>
|
25 | ))}
|
26 | </div>
|
27 | );
|
28 | };
|
29 | return (
|
30 | <Popover title="文件下载" content={Content} trigger="click">
|
31 | <Button type="link">
|
32 | <FilePptOutlined style={{ fontSize: "16px" }} />
|
33 | {showCount ? (
|
34 | <span style={{ marginLeft: "5px" }}>{values.length}</span>
|
35 | ) : (
|
36 | ""
|
37 | )}
|
38 | </Button>
|
39 | </Popover>
|
40 | );
|
41 | }
|