t-lj-service 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/UniappTool.xml +10 -0
- package/README.md +1 -0
- package/module/qiankun/qiankun.ts +15 -17
- package/package.json +4 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
|
|
4
|
+
<option name="generalBasePath" value="$PROJECT_DIR$" />
|
|
5
|
+
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
|
|
6
|
+
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
|
|
7
|
+
<option name="scanNum" value="1" />
|
|
8
|
+
<option name="type" value="store" />
|
|
9
|
+
</component>
|
|
10
|
+
</project>
|
package/README.md
CHANGED
|
@@ -78,16 +78,16 @@ const autoApp = (url: string = '/business/') => {
|
|
|
78
78
|
|
|
79
79
|
// 子系统
|
|
80
80
|
type GlobalIcons = Record<string, Component>;
|
|
81
|
-
const
|
|
82
|
-
container.style.width = `${window.innerWidth -
|
|
83
|
-
container.style.height = `${window.innerHeight -
|
|
81
|
+
const _set = (container: HTMLDivElement, padding: number[] = [ 0, 0 ],) => {
|
|
82
|
+
container.style.width = `${window.innerWidth - padding[0]}px`
|
|
83
|
+
container.style.height = `${window.innerHeight - padding[1]}px`
|
|
84
84
|
container.style.boxSizing = `border-box`
|
|
85
85
|
}
|
|
86
|
-
const _window = (container: HTMLDivElement, type: number = 1) => {
|
|
86
|
+
const _window = (container: HTMLDivElement, type: number = 1, padding: number[] = [ 0, 0 ],) => {
|
|
87
87
|
if(type === 1){
|
|
88
|
-
window.addEventListener('resize', () =>
|
|
88
|
+
window.addEventListener('resize', () => _set(container, padding));
|
|
89
89
|
} else {
|
|
90
|
-
window.removeEventListener('resize', () =>
|
|
90
|
+
window.removeEventListener('resize', () => _set(container, padding));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
const render = (
|
|
@@ -97,6 +97,7 @@ const render = (
|
|
|
97
97
|
id: string = '#container',
|
|
98
98
|
icons: GlobalIcons | null = null,
|
|
99
99
|
props: QiankunProps = {},
|
|
100
|
+
padding: number[] = [ 0, 0 ],
|
|
100
101
|
) => {
|
|
101
102
|
const { container, actions } = props;
|
|
102
103
|
root = createApp(App);
|
|
@@ -115,16 +116,10 @@ const render = (
|
|
|
115
116
|
use.forEach((item: any) => {
|
|
116
117
|
root.use(item.module, item.options || {});
|
|
117
118
|
})
|
|
118
|
-
// registerElementPlusIcons(root);
|
|
119
|
-
// root.use(router);
|
|
120
|
-
// root.use(ElementPlus, {
|
|
121
|
-
// locale: ZhCn,
|
|
122
|
-
// });
|
|
123
|
-
// root.use(i18n);
|
|
124
119
|
|
|
125
120
|
const c: any = container?.querySelector(id) || document.querySelector(id);
|
|
126
|
-
|
|
127
|
-
_window(c)
|
|
121
|
+
_set(c, padding);
|
|
122
|
+
_window(c, 1, padding)
|
|
128
123
|
root.mount(c);
|
|
129
124
|
}
|
|
130
125
|
|
|
@@ -134,17 +129,18 @@ const initQianKun = (
|
|
|
134
129
|
use: any[] = [],
|
|
135
130
|
id: string = '#container',
|
|
136
131
|
icons: GlobalIcons | null = null,
|
|
132
|
+
padding: number[] = [ 0, 0 ],
|
|
137
133
|
):void => {
|
|
138
134
|
renderWithQiankun({
|
|
139
135
|
async mount(props: QiankunProps) {
|
|
140
136
|
console.log(props);
|
|
141
|
-
render(root, App, use, id, icons, props);
|
|
137
|
+
render(root, App, use, id, icons, props, padding);
|
|
142
138
|
},
|
|
143
139
|
bootstrap() {},
|
|
144
140
|
unmount(props: QiankunProps): void | Promise<void> {
|
|
145
141
|
const { container } = props;
|
|
146
142
|
const c: any = container?.querySelector(id) || document.querySelector(id);
|
|
147
|
-
_window(c, 0);
|
|
143
|
+
_window(c, 0, padding);
|
|
148
144
|
root.unmount();
|
|
149
145
|
},
|
|
150
146
|
update(props: QiankunProps): void | Promise<void> {
|
|
@@ -160,18 +156,20 @@ const useApp = ({
|
|
|
160
156
|
use = [],
|
|
161
157
|
id = '#container',
|
|
162
158
|
icons = null,
|
|
159
|
+
padding = [ 0, 0 ],
|
|
163
160
|
}: {
|
|
164
161
|
root?: ReturnType<typeof createApp> | null,
|
|
165
162
|
App?: Component,
|
|
166
163
|
use?: any[],
|
|
167
164
|
id?: string,
|
|
168
165
|
icons?: GlobalIcons | null,
|
|
166
|
+
padding?: number[],
|
|
169
167
|
} = {}) => {
|
|
170
168
|
if (!App) {
|
|
171
169
|
throw new Error('App 组件不能为空');
|
|
172
170
|
}
|
|
173
171
|
const appRoot = root || createApp(App);
|
|
174
|
-
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQianKun(appRoot, App, use, id, icons) : render(appRoot, App, use, id ,icons)
|
|
172
|
+
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQianKun(appRoot, App, use, id, icons, padding) : render(appRoot, App, use, id ,icons, padding)
|
|
175
173
|
};
|
|
176
174
|
|
|
177
175
|
|