From ada2673032fe56d1b95027935967e67bb0bd5a94 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Fri, 27 Nov 2015 02:54:28 +0900 Subject: [PATCH] feat(index): support automatically install for standalone --- src/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 54df78185..d8cea0bbd 100644 --- a/src/index.js +++ b/src/index.js @@ -2,13 +2,13 @@ import extend from './extend' /** - * plugin + * install * * @param {Object} Vue * @param {Object} opts */ -export default function (Vue, opts = { lang: 'en', locales: {} }) { +export default function install (Vue, opts = { lang: 'en', locales: {} }) { defineConfig(Vue.config, opts.lang) extend(Vue, opts.locales) } @@ -30,3 +30,12 @@ function defineConfig (config, lang) { set: (val) => { lang = val } }) } + + +/** + * install automaticlly + */ + +if (typeof window !== 'undefined' && window.Vue) { + window.Vue.use(install) +}