4
4
* @Author : Jason chen
5
5
* @Date : 2021-08-18 15:09 :23
6
6
* @LastEditors : Jason chen
7
- * @LastEditTime : 2021-09-16 11: 13 : 40
7
+ * @LastEditTime : 2021-09-16 15: 38 : 35
8
8
-->
9
9
<template>
10
10
<div class="vue-app3">
22
22
</div>
23
23
</template>
24
24
<script>
25
- import { loadRemoteComponent, loadLink } from './untils/index.js'
25
+ import { loadRemoteComponent, getComponentInfo } from './untils/index.js'
26
26
export default {
27
27
components: {
28
28
appTwoChildren: (async () => {
29
- let nacosInstancesList;
30
29
let serAdd = '';
31
30
try {
32
- let res = await fetch('/nacos/getAllInstances', {
33
- method: 'get'
34
- })
35
- nacosInstancesList = await res.json();
36
- let app2Info = nacosInstancesList.filter(item => item.metadata.componentName.includes('app2')).pop();
31
+ let app2Info = await getComponentInfo('app2')
37
32
serAdd = `http://${app2Info.metadata.address}`
38
33
} catch {
39
34
serAdd = `./mfpApps/app2/deploy/app2.js`
@@ -46,16 +41,10 @@ export default {
46
41
return app2
47
42
}),
48
43
appOneChildren: (async () => {
49
- let nacosInstancesList;
50
44
let serAdd = '';
51
45
try {
52
- let res = await fetch('/nacos/getAllInstances', {
53
- method: 'get'
54
- })
55
- nacosInstancesList = await res.json();
56
- let app1Info = nacosInstancesList.filter(item => item.metadata.componentName.includes('app1')).pop();
46
+ let app1Info = await getComponentInfo('app1')
57
47
serAdd = `http://${app1Info.metadata.address}`;
58
- console.log('----------', serAdd)
59
48
} catch {
60
49
serAdd = `./mfpApps/app1/deploy/app1.js`
61
50
}
@@ -65,17 +54,14 @@ export default {
65
54
module: './appOneChildren'
66
55
})
67
56
// 加载iconfont
68
- const iconjs = await loadRemoteComponent({
57
+ await loadRemoteComponent({
69
58
url: serAdd,
70
59
scope: 'vueAppOne',
71
60
module: './appOneIconfont'
72
61
})
73
62
return app1
74
63
})
75
64
},
76
- mounted () {
77
-
78
- },
79
65
};
80
66
</script>
81
67
<style lang="less">
0 commit comments