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

expandIcon slot失效,并且会阻止图标渲染 #123

Closed
Carnia opened this issue Mar 29, 2023 · 2 comments
Closed

expandIcon slot失效,并且会阻止图标渲染 #123

Carnia opened this issue Mar 29, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Carnia
Copy link

Carnia commented Mar 29, 2023

<STable>
        <template #expandIcon="props">
        <span v-if="props.record?.children?.length">
          <Icon
            style="cursor: pointer"
            :icon="
              props.expanded ? 'ant-design:caret-down-outlined' : 'ant-design:caret-right-outlined'
            "
            @click="
              (e) => {
                props.onExpand(props.record, e);
              }
            "
          />
        </span>
      </template>
</STable>

上述#expandIcon的slot代码会导致自定义展开按钮渲染不出来,同样的代码ant design版本的table没有问题。

目前的解决方法只能通过expandIcon去写:

<STable 
        :expandIcon="
        (props) => {
          return props.record?.children?.length
            ? h(Icon, {
                style: 'cursor: pointer; float: left; margin-top: 2px',
                icon: props.expanded
                  ? 'ant-design:caret-down-outlined'
                  : 'ant-design:caret-right-outlined',
                onClick: (e) => {
                  props.onExpand(props.record, e);
                },
              })
            : null;
        }
      "
/>

但是这样要额外导入h函数。

@Carnia
Copy link
Author

Carnia commented Mar 29, 2023

版本3.0.2

@tangjinzhou tangjinzhou added the bug Something isn't working label Apr 7, 2023
@tangjinzhou
Copy link
Contributor

update to 3.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants