amis icon indicating copy to clipboard operation
amis copied to clipboard

在SDK使用中CRUD导出功能无反应

Open xichangzhou opened this issue 3 years ago • 7 comments

存在的问题:

在SDK使用中CRUD导出功能无反应,点击全量导出 Excel按钮毫无反应

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <title>amis demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <link rel="stylesheet" href="sdk.css" />
    <link rel="stylesheet" href="helper.css" />
    <style>
        html,
        body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="root" class="app-wrapper"></div>
    <script src="sdk.js"></script>
    <script src="exceljs.js"></script>
    <script type="text/javascript">
        (function () {
            let amis = amisRequire('amis/embed');
            // 通过替换下面这个配置来生成不同页面
            let amisJSON = {
                type: 'page',
                title: 'CRUD',
                body: {
                    "type": "crud",
                    "headerToolbar": [
                        {
                            "type": "export-excel",
                            "label": "全量导出 Excel",
                            "api": "https://aisuda.bce.baidu.com/amis/api/mock2/sample"
                        }
                    ],
                    "syncLocation": false,
                    "columns": [
                        {
                            "name": "id",
                            "label": "ID"
                        },
                        {
                            "name": "engine",
                            "label": "Rendering engine"
                        },
                        {
                            "name": "browser",
                            "label": "Browser"
                        },
                        {
                            "name": "platform",
                            "label": "Platform(s)"
                        },
                        {
                            "name": "version",
                            "label": "Engine version"
                        },
                        {
                            "name": "grade",
                            "label": "CSS grade"
                        },
                    ]
                }
            };
            let amisScoped = amis.embed('#root', amisJSON);
        })();
    </script>
</body>

</html>

xichangzhou avatar May 05 '23 05:05 xichangzhou

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

github-actions[bot] avatar May 05 '23 05:05 github-actions[bot]

这个跟 sdk 没关系,是接口跨域问题,请改成这个接口 https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample

2betop avatar May 06 '23 04:05 2betop

不是接口地址问题,我换过其他地址也不行,换成你这个地址也是不行的

xichangzhou avatar May 06 '23 04:05 xichangzhou

@2betop

xichangzhou avatar May 08 '23 09:05 xichangzhou

我也遇到了类似的问题,不过我没有用api,直接用的"export-excel"前端导出。怎么点导出按钮都没有反应,是缺少什么依赖吗? @2betop

Xuxin19960702 avatar May 11 '23 07:05 Xuxin19960702

我也遇到了类似的问题,不过我没有用api,直接用的"export-excel"前端导出。怎么点导出按钮都没有反应,是缺少什么依赖吗? @2betop

是的,他不回复了,不知道怎么解决

xichangzhou avatar May 25 '23 09:05 xichangzhou

下载最新的sdk已经可以导出excel

xichangzhou avatar May 27 '23 07:05 xichangzhou