优化首页加载

This commit is contained in:
aixianling
2022-05-12 09:49:40 +08:00
parent 7b967a8540
commit 115ba62141
3 changed files with 27 additions and 35 deletions

View File

@@ -22,10 +22,10 @@
</div>
<input class="codeText" v-model="search" placeholder="搜索要查找的应用"/>
<div class="appsPane flex">
<div v-for="app in appsList" :key="app.key" @tap="handleGotoApp(app)" class="appItem flex">
<b v-text="app.name"/>
<div v-for="app in appsList" :key="app.id" @tap="handleGotoApp(app)" class="appItem flex">
<b v-text="app.label"/>
(
<div v-text="app.key"/>
<div v-text="app.name"/>
)
</div>
</div>
@@ -54,7 +54,7 @@ export default {
},
appsList() {
let {search} = this
return this.apps?.filter(e => !!search ? e.name.indexOf(search) > -1 : true) || []
return this.apps?.filter(e => !!search ? e.label?.indexOf(search) > -1 : true) || []
},
},
methods: {
@@ -65,19 +65,16 @@ export default {
}
},
handleGotoApp(app) {
uni.navigateTo({url: `/mods${app.path}`})
uni.navigateTo({url: `${app.path}`})
},
getApps() {
this.apps = []
// let applications = require.context('../', true, /\.(\/.+)\/App[^\/]+\.vue$/, 'lazy')
// applications.keys().map(path => {
// applications(path).then(file => {
// if (file.default) {
// let {name: key, appName: name} = file.default
// this.apps.push({key, name, path: path.replace(/^\.(.+).vue$/g, '$1')})
// }
// })
// })
this.$instance.post("/node/wechatapps/list", null, {
baseURL: "http://localhost:12525", params: {size: 999}
}).then(res => {
if (res?.data) {
this.apps = res.data.records.map(e => ({...e, path: e.libPath}))
}
})
},
getAuth() {
this.$nextTick(() => {