mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-25 20:30:19 +00:00
perf: 微应用优化
This commit is contained in:
parent
2813f4c062
commit
a55e0a457d
@ -56,15 +56,14 @@ export default {
|
||||
return {
|
||||
showSpin: false,
|
||||
loading: false,
|
||||
appUrl: '',
|
||||
appData: {},
|
||||
}
|
||||
},
|
||||
deactivated() {
|
||||
},
|
||||
mounted() {
|
||||
this.showSpin = true;
|
||||
this.appData = this.getAppData
|
||||
|
||||
console.log(this.url)
|
||||
},
|
||||
watch: {
|
||||
loading(val){
|
||||
@ -72,17 +71,6 @@ export default {
|
||||
this.showSpin = true;
|
||||
}
|
||||
},
|
||||
url(val) {
|
||||
this.loading = true;
|
||||
this.$nextTick(() => {
|
||||
this.loading = false;
|
||||
let url = $A.apiUrl(val)
|
||||
if (url.indexOf('http') == -1) {
|
||||
url = window.location.origin + url
|
||||
}
|
||||
this.appUrl = import.meta.env.VITE_OKR_WEB_URL || url
|
||||
})
|
||||
},
|
||||
path(val) {
|
||||
this.appData = { path: val }
|
||||
},
|
||||
@ -166,7 +154,7 @@ export default {
|
||||
window.dispatchEvent(new Event('apps-unmount'));
|
||||
},
|
||||
handleError(e) {
|
||||
console.error("子应用加载出错了",e.detail.error)
|
||||
// console.error("子应用加载出错了",e.detail.error)
|
||||
},
|
||||
handleDataChange(e) {
|
||||
// console.log('来自子应用 child-vite 的数据:', e.detail.data)
|
||||
|
||||
19
resources/assets/js/microapp.js
vendored
19
resources/assets/js/microapp.js
vendored
@ -1,9 +1,5 @@
|
||||
import microApp from '@micro-zoe/micro-app'
|
||||
|
||||
const getUrl = (url) => {
|
||||
return import.meta.env.VITE_OKR_WEB_URL || $A.apiUrl(url);
|
||||
}
|
||||
|
||||
export default function() {
|
||||
let urls = "";
|
||||
let route = "/";
|
||||
@ -24,24 +20,15 @@ export default function() {
|
||||
return code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 微应用名称
|
||||
modules["micro-app"] = [obj]
|
||||
modules["okr-details"] = [obj]
|
||||
|
||||
|
||||
// 微应用
|
||||
microApp.start({
|
||||
plugins: {
|
||||
modules: modules
|
||||
}
|
||||
})
|
||||
|
||||
//预加载
|
||||
microApp.preFetch([
|
||||
{
|
||||
name: 'micro-app',
|
||||
url: getUrl("../apps/okr"),
|
||||
disableSandbox: true
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
@ -580,7 +580,7 @@ export default {
|
||||
$A.modalError({
|
||||
content: msg,
|
||||
onOk: _ => {
|
||||
this.$refs.code.focus()
|
||||
this.$refs.code?.focus()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user