Commit f620ac11 by luyt

feat:新增业务模块组件

1 parent 1ea10144
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -70,8 +70,8 @@
title: '业务组件',
links:[
{
title: 'Blog',
link: '/components/Blog'
title: 'GLBcTest',
link: '/components/GLBcTest'
},
]
}
......
......@@ -140,9 +140,16 @@
<!-- 测试 GLFooter -->
<GLFooter></GLFooter>
<hr />
<!-- 测试 GLProvince -->
<GLProvince ref="provinceForm2" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" @selectTown="selectTown"></GLProvince>
<hr />
<!-- 测试业务组件GLBcTest -->
<GLBcTest></GLBcTest>
<hr />
</div>
</template>
<script>
......
import GLBcTest from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLBcTest.install = function(Vue) {
Vue.component(GLBcTest.name, GLBcTest)
}
// 默认导出组件
export default GLBcTest
\ No newline at end of file
## 我是业务组件文档测试
\ No newline at end of file
<template>
<div>
hello world <el-button>点我</el-button>
</div>
</template>
<script>
export default {
name:'GLBcTest',
props:{
// 业务组件test
test:{
type: String,
default: ''
}
},
data () {
return {
};
},
created(){},
mounted(){},
methods: {},
components: {},
computed: {},
}
</script>
<style lang='scss'>
</style>
\ No newline at end of file
......@@ -3,12 +3,24 @@
*/
import Vue from 'vue'
import GLButton from './packages/Button'
const componentsFiles = require.context(`./packages`, true, /\.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
// console.log('component: ', component);
Vue.component(component.name, component)
})
//自动读取并注册组件
function registerComp(componentsFiles){
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
// console.log('component: ', component);
Vue.component(component.name, component)
})
}
function registerComponent(){
const componentsFiles = require.context('./packages', true, /\.vue$/)
registerComp(componentsFiles)
const componentsFilesBc = require.context('./bcPackages', true, /\.vue$/)
registerComp(componentsFilesBc)
}
registerComponent()
//函数组件
const permissions = {
......
......@@ -6,6 +6,7 @@
//创建的组件
import Vue from 'vue'
import {
// 基础
GLExternal,
GLButton,
GLDialog,
......@@ -15,7 +16,9 @@
GLSearchItem,
GLCombiForm,
GLTableButton,
// 业务
GLProvince,
GLBcTest
} from '../../dist/glsx-components.umd.min.js'
import '../../dist/glsx-components.css'
......@@ -36,3 +39,4 @@
Vue.use(GLCombiForm)
Vue.use(GLTableButton)
Vue.use(GLProvince)
Vue.use(GLBcTest)
......@@ -9,7 +9,7 @@ import '@/theme/theme.scss'
// 一次性注册所有的过滤器 本地测试
import filters from '@/filters'
// test 组件
// 导入基础组件
import TestComp from './TestComp'
import GLExternal from './External'
......@@ -23,11 +23,17 @@ import GLCombiForm from './GlCombiForm'
import GLTableButton from './GlTableButton'
import GLProvince from './GLProvince'
// 导入业务组件
import GLBcTest from '@/bcPackages/GLBcTest'
//el原始组件
const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu]
// 业务组件导入列表
const BcComponent = [GLBcTest]
// 存储组件列表
const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince].concat(ElComponent)
const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince].concat(ElComponent).concat(BcComponent)
// console.log('components: ', components);
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
......@@ -50,6 +56,8 @@ export default {
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
install,
...ElComponent,
// ...BcComponent,
// 基础组件
TestComp,
GLExternal,
GLButton,
......@@ -60,5 +68,8 @@ export default {
GLSearchItem,
GLCombiForm,
GLTableButton,
GLProvince
//业务组件
GLProvince,
GLBcTest
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!