refactor: install 1 ui for no more than 1 time on 1 vue

This commit is contained in:
07akioni 2020-05-28 11:57:33 +08:00
parent 994701d39a
commit 0c4c712a05

View File

@ -15,6 +15,7 @@ function create ({
fallbackLocale,
hljs
}) {
const installTargets = []
const naive = {
locales: createLocalesObject(locales),
fallbackLocale: fallbackLocale || locales[0],
@ -24,6 +25,8 @@ function create ({
install
}
function install (Vue) {
if (installTargets.includes(Vue)) return
installTargets.push(Vue)
Vue.prototype.$naive = naive
for (const component of components) {
component.install(Vue)