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

使用ConfigProvider组件引起Maximum call stack size exceeded #2887

Closed
1 task
lizhongzhen11 opened this issue Sep 23, 2020 · 8 comments
Closed
1 task
Labels

Comments

@lizhongzhen11
Copy link

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

Version

2.0.0-beta.5

Environment

vue3,vue-cli 4.5.6

Reproduction link

Edit on CodeSandbox

Steps to reproduce

使用vue-cli 4.5.6搭建环境,选择vue3,然后照着官方文档引入ant-design-vue,一开始正常,直到引入ConfigProvider组件,发现浏览器报栈溢出,把它去掉刷新还是报栈溢出:

// main.js
import { createApp } from 'vue'
import App from './App.vue'
import {
ConfigProvider,
Button,
} from 'ant-design-vue';

createApp(App).provide(ConfigProvider).use(Button).mount('#app')


// App.vue
<template>
<a-config-provider :locale="locale">
<App />
</a-config-provider>
</template>

<script>
import zhCN from 'ant-design-vue/es/locale/zh_CN';

export default {
name: 'App',
data() {
return {
locale: zhCN,
};
},
}
</script>

最可怕的是把 ant-design-vue 卸载后,相关配置删掉,再启动还报这个错误!是不是使用 ConfigProvider 这个组件后不管成功失败都会修改环境代码?

What is expected?

正常运行

What is actually happening?

Maximum call stack size exceeded

@sendya
Copy link
Member

sendya commented Sep 23, 2020

-- createApp(App).provide(ConfigProvider).use(Button).mount('#app')
++ createApp(App).use(ConfigProvider).use(Button).mount('#app')
  1. 不可能改环境代码

@lizhongzhen11
Copy link
Author

@sendya
我一开始就用的 use,也报这个错,然后看文档说 ConfigProvider 使用 Vue 的 provide / inject 特性,只需在应用外围包裹一次即可全局生效。 改用 provide,可还是不行。

奇怪的是为何我把 ant-design-vue 卸载掉,相关内容删掉,为何启动还报这个错呢?

@sendya
Copy link
Member

sendya commented Sep 23, 2020

为何还报错就要问你自己了,环境在你那边 也不再我们这。
你可以自己过一遍流程,有没有重启之类的

@lizhongzhen11
Copy link
Author

@sendya
Copy link
Member

sendya commented Sep 23, 2020

App 引入 App ? 看不懂你的操作

@lizhongzhen11
Copy link
Author

卧槽,我SB了,无脑复制粘贴官方文档内容,没意识到内部又引入了 ,丢脸啊。。。

@whwhz
Copy link

whwhz commented Feb 5, 2021

老哥怎么解决的, 我整体antd引入也有这个问题

@github-actions
Copy link

github-actions bot commented Feb 6, 2022

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 Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants