Commit 1293a7389ea797b1c1dad62e06657c846b1dcb3c

Authored by vben
1 parent f7ec3c93

fix: fix modal and drawer component missing uid

CHANGELOG.zh_CN.md
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 - 修复 axios 大小写问题 22 - 修复 axios 大小写问题
23 - 修复按钮样式问题 23 - 修复按钮样式问题
24 - 修复菜单分割模式问题 24 - 修复菜单分割模式问题
  25 +- 修复 `Modal`与`Drawer`组件在使用 emits 数据传递失效问题
25 26
26 ## 2.0.0-rc.13 (2020-12-10) 27 ## 2.0.0-rc.13 (2020-12-10)
27 28
src/components/Application/index.ts
1 import { withInstall } from '../util'; 1 import { withInstall } from '../util';
2 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; 2 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  3 +import AppLogo from './src/AppLogo.vue';
3 4
4 export const AppLocalePicker = createAsyncComponent(() => import('./src/AppLocalePicker.vue'), { 5 export const AppLocalePicker = createAsyncComponent(() => import('./src/AppLocalePicker.vue'), {
5 loading: true, 6 loading: true,
@@ -8,8 +9,9 @@ export const AppProvider = createAsyncComponent(() => import('./src/AppProvider. @@ -8,8 +9,9 @@ export const AppProvider = createAsyncComponent(() => import('./src/AppProvider.
8 export const AppSearch = createAsyncComponent(() => import('./src/search/AppSearch.vue'), { 9 export const AppSearch = createAsyncComponent(() => import('./src/search/AppSearch.vue'), {
9 loading: true, 10 loading: true,
10 }); 11 });
11 -export const AppLogo = createAsyncComponent(() => import('./src/AppLogo.vue')); 12 +// export const AppLogo = createAsyncComponent(() => import('./src/AppLogo.vue'));
12 13
13 withInstall(AppLocalePicker, AppLogo, AppProvider, AppSearch); 14 withInstall(AppLocalePicker, AppLogo, AppProvider, AppSearch);
14 15
15 export { useAppProviderContext } from './src/useAppContext'; 16 export { useAppProviderContext } from './src/useAppContext';
  17 +export { AppLogo };
src/components/Drawer/src/useDrawer.ts
@@ -102,7 +102,7 @@ export const useDrawerInner = (callbackFn?: Fn): UseDrawerInnerReturnType => { @@ -102,7 +102,7 @@ export const useDrawerInner = (callbackFn?: Fn): UseDrawerInnerReturnType => {
102 102
103 uidRef.value = uuid; 103 uidRef.value = uuid;
104 drawerInstanceRef.value = modalInstance; 104 drawerInstanceRef.value = modalInstance;
105 - currentInstall.emit('register', modalInstance); 105 + currentInstall.emit('register', modalInstance, uuid);
106 }; 106 };
107 107
108 watchEffect(() => { 108 watchEffect(() => {
src/components/Modal/src/useModal.ts
@@ -90,6 +90,9 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => { @@ -90,6 +90,9 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => {
90 throw new Error('instance is undefined!'); 90 throw new Error('instance is undefined!');
91 } 91 }
92 92
  93 + // currentInstall.type.emits = [...currentInstall.type.emits, 'register'];
  94 + // Object.assign(currentInstall.type.emits, ['register']);
  95 +
93 const getInstance = () => { 96 const getInstance = () => {
94 const instance = unref(modalInstanceRef); 97 const instance = unref(modalInstanceRef);
95 if (!instance) { 98 if (!instance) {
@@ -103,10 +106,9 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => { @@ -103,10 +106,9 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => {
103 tryOnUnmounted(() => { 106 tryOnUnmounted(() => {
104 modalInstanceRef.value = null; 107 modalInstanceRef.value = null;
105 }); 108 });
106 -  
107 uidRef.value = uuid; 109 uidRef.value = uuid;
108 modalInstanceRef.value = modalInstance; 110 modalInstanceRef.value = modalInstance;
109 - currentInstall.emit('register', modalInstance); 111 + currentInstall.emit('register', modalInstance, uuid);
110 }; 112 };
111 113
112 watchEffect(() => { 114 watchEffect(() => {
src/layouts/default/header/LayoutMultipleHeader.less
1 .multiple-tab-header { 1 .multiple-tab-header {
2 - flex: 0 0 auto; 2 + margin-left: 1px;
3 transition: width 0.2s; 3 transition: width 0.2s;
  4 + flex: 0 0 auto;
4 5
5 &.dark { 6 &.dark {
6 - margin-left: -1px; 7 + margin-left: 0;
7 } 8 }
8 9
9 &.fixed { 10 &.fixed {
src/layouts/default/index.less
@@ -12,6 +12,6 @@ @@ -12,6 +12,6 @@
12 } 12 }
13 13
14 &__main { 14 &__main {
15 - margin-left: 2px; 15 + margin-left: 1px;
16 } 16 }
17 } 17 }
src/layouts/default/sider/index.less
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 } 25 }
26 26
27 &:not(.ant-layout-sider-dark) { 27 &:not(.ant-layout-sider-dark) {
28 - box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); 28 + // box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
29 29
30 .ant-layout-sider-trigger { 30 .ant-layout-sider-trigger {
31 color: @text-color-base; 31 color: @text-color-base;