amis icon indicating copy to clipboard operation
amis copied to clipboard

amis 6.3.0 api的requestAdaptor 中修改api.query ,无法修改请求参数。

Open liangyi-2013 opened this issue 2 years ago • 1 comments

schema 如下,post的时候可以修改请求参数,get的时候就改不了query参数。这里是想删除空值。

{"type":"page","body":{
  "type": "crud",
  "name": "crud",
  "syncLocation": false,
  "api": {
    "url": "https://www.baidu.com/xxx",
    "requestAdaptor": "const d = api.data || api.query;Object.keys(d).forEach(k => {if (!d[k]) {delete d[k]}});return { ...api }"
  },
  "filter": {
    "title": "条件搜索",
    "debug": true,
    "body": [
      {
        "type": "group",
        "body": [
          {
            "type": "input-text",
            "name": "page_name",
            "label": "页面名称",
            "clearable": true,
            "size": "sm"
          },
          {
            "type": "input-text",
            "name": "owner",
            "label": "创建者",
            "clearable": true,
            "size": "sm"
          }
        ]
      }
    ],
    "actions": [{ "type": "submit", "level": "primary", "label": "查询" }]
  },
  "columns": [
    { "name": "page_name", "label": "页面名称" },
    { "name": "owner", "label": "创建者" }
  ]
}}

liangyi-2013 avatar Apr 15 '24 11:04 liangyi-2013

QQ_1723350392841

建议使用编辑器,写js更方便,然后打断点调试即可快速定位问题

Amis低代码前端框架交流群【QQ1群】:717791727 Amis低代码前端框架交流群【QQ2群】:721182449

lhtuling avatar Aug 11 '24 04:08 lhtuling