Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input-table 在执行 addItem 动作的时候 会触发 显示空的"操作"列 #10271

Open
RoosterZhao opened this issue May 20, 2024 · 1 comment

Comments

@RoosterZhao
Copy link

我用 sdk 的方式使用 amis,版本是 v6.3.0
利用 amisScoped 对象执行 addItem 的动作,会导致多出来一个空的 操作 列
image
image

请参照如下代码

<body>
  <div id="root" class="app-wrapper"></div>
  <script type="text/javascript">
    let pageSchema = {
      "type": "page",
      "data": {
        "table": [
          {"a": "a1", "b": "b1" },
          { "a": "a2", "b": "b2"}
        ]
      },
      body: [
        {
          "type": "form",
          "title": "",
          "actions": [],
          "body": [
            {
              "type": "input-table",
              "name": "table",
              "id": "addItem-input-table",
              "columns": [
                {
                  "label": "",
                  "type": "tpl",
                  "tpl": "hello $a, let me try $b!"
                }
              ]
            }
          ]
        }
      ]
    }

    let amis = amisRequire('amis/embed');
    window.__amisScoped = amis.embed('#root', pageSchema);
  </script>
  <script>
      function test1() {
        __amisScoped.doAction(
          [
            {
              actionType: 'addItem',
              componentId: 'addItem-input-table',
              args: {
                "item": [
                  {
                    "a": "a-noIndex",
                    "b": "b-noIndex"
                  }
                ]
              }
            }
          ]
        )
      }
    </script>
  <div>
    <h2>添加条目</h2>
    <button onclick="test1()">add item</button>
  </div>
</body>
@RoosterZhao
Copy link
Author

在添加好条目之后,能否实现一个 自动滚动到 input-table 底部的 功能?
还有,普通的 list,card,table 之类的组件,能否也添加 这个 addItem 的动作呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant