mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-22 23:20:00 +08:00
feat(runtime): vue3使用dynamicImport
This commit is contained in:
parent
c817ad6bb6
commit
a16a7e6a4d
@ -36,9 +36,7 @@ const app = new Core({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(components).forEach((type: string) => {
|
Object.keys(components).forEach((type: string) => {
|
||||||
const component = components[type];
|
Vue.component(`magic-ui-${type}`, components[type]);
|
||||||
Vue.component(`magic-ui-${type}`, component);
|
|
||||||
app.registerComponent(type, component);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.values(plugins).forEach((plugin: any) => {
|
Object.values(plugins).forEach((plugin: any) => {
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createApp } from 'vue';
|
import { createApp, defineAsyncComponent } from 'vue';
|
||||||
|
|
||||||
import Core from '@tmagic/core';
|
import Core from '@tmagic/core';
|
||||||
import { getUrlParam } from '@tmagic/utils';
|
import { getUrlParam } from '@tmagic/utils';
|
||||||
|
|
||||||
import components from '../.tmagic/comp-entry';
|
import components from '../.tmagic/async-comp-entry';
|
||||||
import plugins from '../.tmagic/plugin-entry';
|
import plugins from '../.tmagic/plugin-entry';
|
||||||
|
|
||||||
import request from './utils/request';
|
import request from './utils/request';
|
||||||
@ -33,7 +33,10 @@ const magicApp = createApp(AppComponent);
|
|||||||
magicApp.use(request);
|
magicApp.use(request);
|
||||||
|
|
||||||
Object.entries(components).forEach(([type, component]: [string, any]) => {
|
Object.entries(components).forEach(([type, component]: [string, any]) => {
|
||||||
magicApp.component(`magic-ui-${type}`, component);
|
magicApp.component(
|
||||||
|
`magic-ui-${type}`,
|
||||||
|
defineAsyncComponent(() => component),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.values(plugins).forEach((plugin: any) => {
|
Object.values(plugins).forEach((plugin: any) => {
|
||||||
|
@ -5,4 +5,5 @@ import { defineConfig } from '@tmagic/cli';
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
packages: [path.join(__dirname, '../../packages/ui')],
|
packages: [path.join(__dirname, '../../packages/ui')],
|
||||||
componentFileAffix: '.vue',
|
componentFileAffix: '.vue',
|
||||||
|
dynamicImport: true,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user