import { getScriptOptions } from '@/utils/common' const scriptOptions = getScriptOptions() class pluginLoginAuth { name: string options: any hooks: Record constructor(options = {}) { this.name = 'login' this.hooks = {} this.options = Object.assign( { auto: false, type: 'login-code' }, scriptOptions, options ) if (this.options.auto) { this.init() } } init() { // console.log('init', getScriptOptions()) } use(context) { context.$emit('register-plugin-login-auth', this, { replay: true }) } getInstance() { const hooks = this.hooks return hooks } register(hook, fn) { if (!this.hooks[hook]) { this.hooks[hook] = fn } else { console.warn('not register hook:', hook) } } } const LoginAuth = new pluginLoginAuth() export default LoginAuth