diff --git a/src/components/componentscom/index.js b/src/components/componentscom/index.js deleted file mode 100644 index 50bf02f..0000000 --- a/src/components/componentscom/index.js +++ /dev/null @@ -1,23 +0,0 @@ -export { default as captiontext } from './captiontext' -export { default as pictureads } from './pictureads' -export { default as placementarea } from './placementarea' -export { default as graphicnavigation } from './graphicnavigation' -export { default as richtext } from './richtext' -export { default as magiccube } from './magiccube' -export { default as auxiliarysegmentation } from './auxiliarysegmentation' -export { default as commoditysearch } from './commoditysearch' -export { default as storeinformation } from './storeinformation' -export { default as entertheshop } from './entertheshop' -export { default as notice } from './notice' -export { default as videoss } from './videoss' -export { default as custommodule } from './custommodule' -export { default as communitypowder } from './communitypowder' -export { default as storenotecard } from './storenotecard' -export { default as crowdoperation } from './crowdoperation' -export { default as personalizedrecommendation } from './personalizedrecommendation' -export { default as onlineservice } from './onlineservice' -export { default as listswitching } from './listswitching' -export { default as investigate } from './investigate' -export { default as tabBar } from './tabBar' -export { default as follow } from './follow' -export { default as suspension } from './suspension' diff --git a/src/components/rightslider/componenmanagement/index.vue b/src/components/rightslider/componenmanagement/index.vue index c3ae883..a1c6a7a 100644 --- a/src/components/rightslider/componenmanagement/index.vue +++ b/src/components/rightslider/componenmanagement/index.vue @@ -34,7 +34,7 @@ import vuedraggable from 'vuedraggable' //拖拽组件 export default { - name: 'componenManagement', + name: 'componenmanagement', props: ['datas'], components: { vuedraggable }, data() { diff --git a/src/components/rightslider/index.js b/src/components/rightslider/index.js deleted file mode 100644 index 0a2c266..0000000 --- a/src/components/rightslider/index.js +++ /dev/null @@ -1,24 +0,0 @@ -export { default as decorate } from './decorate' -export { default as componenmanagement } from './componenmanagement' -export { default as captiontextsstyle } from './captiontextsstyle' -export { default as pictureadsstyle } from './pictureadsstyle' -export { default as graphicnavigationstyle } from './graphicnavigationstyle' -export { default as richtextstyle } from './richtextstyle' -export { default as magiccubestyle } from './magiccubestyle' -export { default as auxiliarysegmentationstyle } from './auxiliarysegmentationstyle' -export { default as commoditysearchstyle } from './commoditysearchstyle' -export { default as storeinformationstyle } from './storeinformationstyle' -export { default as entertheshopstyle } from './entertheshopstyle' -export { default as noticestyle } from './noticestyle' -export { default as videostyle } from './videostyle' -export { default as custommodulestyle } from './custommodulestyle' -export { default as communitypowderstyle } from './communitypowderstyle' -export { default as storenotecardstyle } from './storenotecardstyle' -export { default as crowdoperationstyle } from './crowdoperationstyle' -export { default as personalizedrecommendationstyle } from './personalizedrecommendationstyle' -export { default as onlineservicestyle } from './onlineservicestyle' -export { default as listswitchingstyle } from './listswitchingstyle' -export { default as investigatestyle } from './investigatestyle' -export { default as tabBarStyle } from './tabBarStyle' -export { default as followStyle } from './followStyle' -export { default as suspensionstyle } from './suspensionstyle' diff --git a/src/layout/home/index.vue b/src/layout/home/index.vue index 13c953b..19cc415 100644 --- a/src/layout/home/index.vue +++ b/src/layout/home/index.vue @@ -148,70 +148,10 @@ diff --git a/src/permission.js b/src/permission.js index 53f9de8..647f0fe 100644 --- a/src/permission.js +++ b/src/permission.js @@ -26,10 +26,6 @@ import '@/api/request' import httpApi from '@/api/api' Vue.prototype.$httpApi = httpApi -/* 设置cookies */ -/* import VueCookies from 'vue-cookies' -Vue.use(VueCookies) */ - // 挂载 uitls import Utils from './utils/index' Vue.prototype.$utils = Utils @@ -40,3 +36,25 @@ import globalFilter from '@/utils/filter' Object.keys(globalFilter).forEach((key) => { Vue.filter(key, globalFilter[key]) }) + +// 组件自动化全局注册 +const requireComponent = require.context( + // 其组件目录的相对路径 + './components', + // 是否查询其子目录 + true, + // 匹配基础组件文件名的正则表达式 + /\.vue$/ +) +requireComponent.keys().forEach(fileName => { + // 获取组件配置 + const componentConfig = requireComponent(fileName) + // 全局注册组件 + Vue.component( + componentConfig.default.name, // 此处的name,是组件属性定义的name + // 如果这个组件选项是通过 `export default` 导出的, + // 那么就会优先使用 `.default`, + // 否则回退到使用模块的根。 + componentConfig.default + ) +}) \ No newline at end of file