MX BMS
一个基于 Vue 2 和 Element UI 的业务管理系统组件库。
安装
npm install @mxbc/mx-bms
使用
完整引入
import Vue from 'vue'
import MxBMS from '@mxbc/mx-bms'
Vue.use(MxBMS)
按需引入
import Vue from 'vue'
import { DynamicPage } from '@mxbc/mx-bms'
Vue.use(DynamicPage)
组件
DynamicPage 动态页面
一个集成了表单、表格和分页的动态页面组件。
<template>
<mx-dynamic-page
:schema="schema"
:fetch-data="fetchData"
@handleTableRowAction="handleTableRowAction"
/>
</template>
DynamicPage 属性
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|
schema | 页面配置 | object | — | required |
showTable | 是否显示表格 | boolean | — | true |
showForm | 是否显示表单 | boolean | — | true |
showPagination | 是否显示分页 | boolean | — | true |
showSelection | 是否显示多选 | boolean | — | false |
fetchData | 获取数据的方法 | function | — | null |
defaultQueryParams | 默认查询参数 | object | — | { page: 1, limit: 10 } |
Schema 配置示例
const schema = {
formSchema: {
items: [
{
label: '名称',
prop: 'name',
component: 'el-input'
},
{
label: '类型',
prop: 'type',
component: 'el-select',
options: [
{ label: '类型1', value: 1 },
{ label: '类型2', value: 2 }
]
}
],
actions: ['search', 'reset']
},
tableSchema: {
columns: [
{
label: '名称',
prop: 'name'
},
{
label: '操作',
prop: 'actions',
actions: [
{
text: '编辑',
type: 'primary',
name: 'edit'
},
{
text: '删除',
type: 'danger',
name: 'delete'
}
]
}
]
}
}
License
ISC