UNPKG

milnode

Version:

Vue.js Component Framework, build on top of vuetify

43 lines (35 loc) 948 B
import OurVue from 'vue' import genLang from './mixins/lang' import { consoleError } from '@/util/console' const MilNode = { install (Vue, opts = {}) { if (this.installed) return this.installed = true if (OurVue !== Vue) { consoleError('Multiple instances of Vue detected!') } const lang = genLang(opts.lang) Vue.prototype.$milnode = new Vue({ data: { lang }, methods: { t: lang.t.bind(lang) } }) function registerComponents (components) { if (components) { for (const key in components) { const component = components[key] if (component && !registerComponents(component.$_milnode_subcomponents)) { Vue.component(key, component) } } return true } return false } registerComponents(opts.components) } } export default MilNode