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

DirectoryTree: [Vue warn]: Slot "default" invoked outside of the render function #5013

Closed
1 task
think-gem opened this issue Dec 11, 2021 · 5 comments
Closed
1 task
Labels
🤔 Need Reproduce We cannot reproduce your problem outdated

Comments

@think-gem
Copy link

think-gem commented Dec 11, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.2.8

Environment

win、chrome92、vue3

Reproduction link

https://2x.antdv.com/components/tree-cn

Steps to reproduce

The tree directory warns when using TSX:

[Vue warn]: Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.
at <ADirectoryTree>
at <Tree>
......

Example code:

<script lang="tsx">
  import { defineComponent } from 'vue';
  import { Tree } from 'ant-design-vue';
  export default defineComponent({
    setup() {
      return () => {
        return (
          <Tree.DirectoryTree>
            <Tree.TreeNode key="0-0" title="parent 0">
              <Tree.TreeNode key="0-0-0" title="leaf 0-0" is-leaf />
              <Tree.TreeNode key="0-0-1" title="leaf 0-1" is-leaf />
            </Tree.TreeNode>
            <Tree.TreeNode key="0-1" title="parent 1">
              <Tree.TreeNode key="0-1-0" title="leaf 1-0" is-leaf />
              <Tree.TreeNode key="0-1-1" title="leaf 1-1" is-leaf />
            </Tree.TreeNode>
          </Tree.DirectoryTree>
        );
      };
    },
  });
</script>

What is expected?

There is no warning

What is actually happening?

A warning [Vue warn]: Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.

@tangjinzhou tangjinzhou added the 🤔 Need Reproduce We cannot reproduce your problem label Dec 11, 2021
@github-actions
Copy link

Hello @think-gem. Please provide a online reproduction by forking this link for vue2link for vue3 or a minimal GitHub repository. Make sure to choose the correct version.

你好 @think-gem, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 for vue2此处 for vue3 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。请确保选择准确的版本。

@github-actions
Copy link

Since the issue was labeled with Need Reproduce, but no response in 7 days. This issue will be closed. If you have any questions, you can comment and reply.

由于该 issue 被标记为需要复现信息,却 7 天未收到回应。现关闭 issue,若有任何问题,可评论回复。

@GroupOfStar
Copy link

我也遇到了这个警告,虽然可以正常渲染显示,但如果你无视这个警告的话,但打包运行后就无法正常显示了。
这应该是与vue@3.2版本兼容的问题.
参考https://stackoverflow.com/questions/69928229/vue-3-cli-service-app-slot-default-invoked-outside-of-the-render-function-w

@think-gem
Copy link
Author

think-gem commented Jan 14, 2022

@tangjinzhou

Reproduce code:

https://gitee.com/thinkgem/jeesite-vue/blob/master/src/components/Tree/src/Tree.vue#L578

will

const TreeComp = showIcon ? Tree.DirectoryTree : Tree;

change

const TreeComp = Tree;

after modification,no warning.

But I hope, use DirectoryTree no warning.

@tangjinzhou Reopen issues?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤔 Need Reproduce We cannot reproduce your problem outdated
Projects
None yet
Development

No branches or pull requests

3 participants