You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
891 B
30 lines
891 B
import Vue from 'vue'
|
|
|
|
import baseMixin from 'uni-mixins/base'
|
|
import animation from 'uni-mixins/animation'
|
|
|
|
const requireComponents = [
|
|
// baseComponents
|
|
require.context('./', true, /index\.vue$/),
|
|
require.context('../../../platforms/' + __PLATFORM__ + '/view/components', true, /index\.vue$/)
|
|
]
|
|
|
|
requireComponents.forEach((components, index) => {
|
|
components.keys().forEach(fileName => {
|
|
// 获取组件配置
|
|
const componentModule = components(fileName)
|
|
|
|
const componentConfig = componentModule.default || componentModule
|
|
|
|
componentConfig.mixins = componentConfig.mixins ? [].concat(baseMixin, componentConfig.mixins) : [baseMixin]
|
|
|
|
componentConfig.mixins.push(animation)
|
|
|
|
componentConfig.name = 'VUni' + componentConfig.name
|
|
|
|
componentConfig.isReserved = true
|
|
|
|
// 全局注册组件
|
|
Vue.component(componentConfig.name, componentConfig)
|
|
})
|
|
})
|
|
|