import Vue, { PluginFunction } from 'vue' const plugin: PluginFunction = function (this: Vue) { Vue.mixin({ beforeCreate: function () { const options = this.$options if (typeof options.store !== 'undefined') { this.$x = options.store } else if (typeof options?.parent?.$x !== 'undefined') { this.$x = options.parent.$x } } }) } export default plugin