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 @@ ...@@ -70,8 +70,8 @@
title: '业务组件', title: '业务组件',
links:[ links:[
{ {
title: 'Blog', title: 'GLBcTest',
link: '/components/Blog' link: '/components/GLBcTest'
}, },
] ]
} }
......
...@@ -140,9 +140,16 @@ ...@@ -140,9 +140,16 @@
<!-- 测试 GLFooter --> <!-- 测试 GLFooter -->
<GLFooter></GLFooter> <GLFooter></GLFooter>
<hr />
<!-- 测试 GLProvince --> <!-- 测试 GLProvince -->
<GLProvince ref="provinceForm2" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" @selectTown="selectTown"></GLProvince> <GLProvince ref="provinceForm2" :subdistrict="subdistrict" @selectProvince="selectProvince" @selectCity="selectCity" @selectTown="selectTown"></GLProvince>
<hr />
<!-- 测试业务组件GLBcTest -->
<GLBcTest></GLBcTest>
<hr />
</div> </div>
</template> </template>
<script> <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
## 我是业务组件文档测试
\ 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 \ No newline at end of file
...@@ -3,12 +3,24 @@ ...@@ -3,12 +3,24 @@
*/ */
import Vue from 'vue' import Vue from 'vue'
import GLButton from './packages/Button' import GLButton from './packages/Button'
const componentsFiles = require.context(`./packages`, true, /\.vue$/)
componentsFiles.keys().forEach(path => { //自动读取并注册组件
const component = componentsFiles(path).default function registerComp(componentsFiles){
// console.log('component: ', component); componentsFiles.keys().forEach(path => {
Vue.component(component.name, component) 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 = { const permissions = {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
//创建的组件 //创建的组件
import Vue from 'vue' import Vue from 'vue'
import { import {
// 基础
GLExternal, GLExternal,
GLButton, GLButton,
GLDialog, GLDialog,
...@@ -15,7 +16,9 @@ ...@@ -15,7 +16,9 @@
GLSearchItem, GLSearchItem,
GLCombiForm, GLCombiForm,
GLTableButton, GLTableButton,
// 业务
GLProvince, GLProvince,
GLBcTest
} from '../../dist/glsx-components.umd.min.js' } from '../../dist/glsx-components.umd.min.js'
import '../../dist/glsx-components.css' import '../../dist/glsx-components.css'
...@@ -36,3 +39,4 @@ ...@@ -36,3 +39,4 @@
Vue.use(GLCombiForm) Vue.use(GLCombiForm)
Vue.use(GLTableButton) Vue.use(GLTableButton)
Vue.use(GLProvince) Vue.use(GLProvince)
Vue.use(GLBcTest)
...@@ -9,7 +9,7 @@ import '@/theme/theme.scss' ...@@ -9,7 +9,7 @@ import '@/theme/theme.scss'
// 一次性注册所有的过滤器 本地测试 // 一次性注册所有的过滤器 本地测试
import filters from '@/filters' import filters from '@/filters'
// test 组件 // 导入基础组件
import TestComp from './TestComp' import TestComp from './TestComp'
import GLExternal from './External' import GLExternal from './External'
...@@ -23,11 +23,17 @@ import GLCombiForm from './GlCombiForm' ...@@ -23,11 +23,17 @@ import GLCombiForm from './GlCombiForm'
import GLTableButton from './GlTableButton' import GLTableButton from './GlTableButton'
import GLProvince from './GLProvince' import GLProvince from './GLProvince'
// 导入业务组件
import GLBcTest from '@/bcPackages/GLBcTest'
//el原始组件 //el原始组件
const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu] 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); // console.log('components: ', components);
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
...@@ -50,6 +56,8 @@ export default { ...@@ -50,6 +56,8 @@ export default {
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装 // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
install, install,
...ElComponent, ...ElComponent,
// ...BcComponent,
// 基础组件
TestComp, TestComp,
GLExternal, GLExternal,
GLButton, GLButton,
...@@ -60,5 +68,8 @@ export default { ...@@ -60,5 +68,8 @@ export default {
GLSearchItem, GLSearchItem,
GLCombiForm, GLCombiForm,
GLTableButton, 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!