春风项目四线(合箱线、总装线)
wujian
2024-01-20 5e2dda53cc5ec7c02a98a7e959f5225dc044c716
提交 | 用户 | 时间
fd2207 1 import Dict from './Dict'
2 import { mergeOptions } from './DictOptions'
3
4 export default function(Vue, options) {
5   mergeOptions(options)
6   Vue.mixin({
7     data() {
8       if (this.$options === undefined || this.$options.dicts === undefined || this.$options.dicts === null) {
9         return {}
10       }
11       const dict = new Dict()
12       dict.owner = this
13       return {
14         dict
15       }
16     },
17     created() {
18       if (!(this.dict instanceof Dict)) {
19         return
20       }
21       options.onCreated && options.onCreated(this.dict)
22       this.dict.init(this.$options.dicts).then(() => {
23         options.onReady && options.onReady(this.dict)
24         this.$nextTick(() => {
25           this.$emit('dictReady', this.dict)
26           if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
27             this.$options.methods.onDictReady.call(this, this.dict)
28           }
29         })
30       })
31     },
32   })
33 }