mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 02:00:25 +08:00
fix: hmr multiple registered components
This commit is contained in:
parent
a1b9902b97
commit
7a6181e8c7
@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
- 独立出`vite-plugin-html`,并修改相关插入 html 的逻辑
|
- 独立出`vite-plugin-html`,并修改相关插入 html 的逻辑
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- 修复热更新时多次注册组件警告问题
|
||||||
|
|
||||||
## 2.0.0-rc.5 (2020-10-26)
|
## 2.0.0-rc.5 (2020-10-26)
|
||||||
|
|
||||||
### ✨ Features
|
### ✨ Features
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
moment.locale('zh-cn');
|
moment.locale('zh-cn');
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'App',
|
name: 'App1',
|
||||||
components: { ConfigProvider },
|
components: { ConfigProvider },
|
||||||
setup() {
|
setup() {
|
||||||
useInitAppConfigStore();
|
useInitAppConfigStore();
|
||||||
|
@ -5,8 +5,13 @@ import { Button as AntButton } from 'ant-design-vue';
|
|||||||
import { getApp } from '/@/useApp';
|
import { getApp } from '/@/useApp';
|
||||||
|
|
||||||
const compList = [Icon, BasicHelp, BasicTitle, Button, AntButton.Group];
|
const compList = [Icon, BasicHelp, BasicTitle, Button, AntButton.Group];
|
||||||
|
|
||||||
|
// Fix hmr multiple registered components
|
||||||
|
let registered = false;
|
||||||
export function registerGlobComp() {
|
export function registerGlobComp() {
|
||||||
|
if (registered) return;
|
||||||
compList.forEach((comp: any) => {
|
compList.forEach((comp: any) => {
|
||||||
getApp().component(comp.name, comp);
|
getApp().component(comp.name, comp);
|
||||||
});
|
});
|
||||||
|
registered = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user