mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-24 12:45:18 +08:00
refactor: install 1 ui for no more than 1 time on 1 vue
This commit is contained in:
parent
994701d39a
commit
0c4c712a05
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user