Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/vue3' into vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
lbw committed Sep 28, 2022
2 parents a93763c + 6e21eb8 commit c50efd7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Avue from '@smallwei/avue';
import AvueFormDesign from '@sscfaith/avue-form-design';
import '@smallwei/avue/lib/index.css';
import {getScreen, downBlobFile} from '@/util/index'
import dict from '@/util/dict'
import './permission';
import error from './error';
import basicBlock from 'components/basic-block/main.vue'
Expand All @@ -36,6 +37,7 @@ app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.website = website
app.config.globalProperties.getScreen = getScreen
app.config.globalProperties.downBlobFile = downBlobFile
dict(app);
app.use(error);
app.use(i18n)
app.use(animate)
Expand Down
33 changes: 33 additions & 0 deletions src/util/dict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { remote } from '@/api/admin/dict'
export default (app) => {
app.mixin({
data () {
return {
dict: {}
}
},
created () {
let list = this.$options.dict;
if (list) {
let result = [];
list.forEach(ele => {
result.push(new Promise(resolve => {
let obj = {}
obj[ele] = []
remote(ele).then(res => {
obj[ele] = res.data
resolve(obj)
}).catch(() => {
resolve(obj)
})
}))
})
Promise.all(result).then(res => {
res.forEach(ele => {
this.dict = Object.assign(this.dict, ele)
})
})
}
}
})
}

0 comments on commit c50efd7

Please sign in to comment.