You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
889 B

1 month ago
  1. var Vue = require('vue')
  2. var VueCompositionAPI = require('@vue/composition-api')
  3. function install(_vue) {
  4. var vueLib = _vue || Vue
  5. if (vueLib && 'default' in vueLib) {
  6. vueLib = vueLib.default
  7. }
  8. if (vueLib && !vueLib['__composition_api_installed__']) {
  9. if (VueCompositionAPI && 'default' in VueCompositionAPI)
  10. vueLib.use(VueCompositionAPI.default)
  11. else if (VueCompositionAPI)
  12. vueLib.use(VueCompositionAPI)
  13. }
  14. }
  15. install(Vue)
  16. Object.keys(VueCompositionAPI).forEach(function(key) {
  17. exports[key] = VueCompositionAPI[key]
  18. })
  19. exports.Vue = Vue
  20. exports.Vue2 = Vue
  21. exports.isVue2 = true
  22. exports.isVue3 = false
  23. exports.install = install
  24. exports.version = Vue.version
  25. // Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
  26. exports.hasInjectionContext = function () {
  27. return !!VueCompositionAPI.getCurrentInstance()
  28. }