File size: 398 Bytes
4d70170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import type { App } from 'vue'

interface Options {
  refs: { [key: string]: any }
}

export default {
  install(app: App, options: Options) {
    const { refs } = options
    const wrapper = {}
    Object.keys(refs).forEach((key) => {
      const get = refs[key]
      Object.defineProperty(wrapper, key, {
        get,
      })
    })
    app.config.globalProperties.$globalRefs = wrapper
  },
}