UNPKG

nice-plateform-plugin-h5

Version:

private vue components.

85 lines (80 loc) 3.25 kB
# nice-plateform-plugin ### 使用时确保项目中已安装 axios zj-interceptors插件 #### packages: - `files` - `src`: 组件核心代码 - `index.js`: 组件导出文件 - `config.js`: 组件配置文件 - `index.js`: 全部组件导出文件 - `config.js`:全部组件配置文件 #### config.js 组件配合参数配置说明 ```javascript { component: 'JybButton', // 组件名称、组件类型(驼峰式命名) label: '按钮', // 组件中文名称 icon: '', //组件icon propValue: { // 组件属性配置面板可以配置的属性(组件props) text: "按钮", type: 'warning', loading: false }, attrConfig: [ // 组件属性配置面板设置 { label: '按钮文字', // 配置内容 prop: 'text', // 配置属性(propValue内) type: 'textarea', //number textarea // 属性值输入表单控件类型(目前只支持 textarea、number、textarea、select、colorPicker、switch、list')list: 对应的prop数据为[{label:'', prop:''}] option: [], // select类型下下拉框选项内容 (数据形式为[{label,value}]) activeText: '是', // switch 下 为真时显示文字 inactiveText: '否', // switch 下 为假时显示文字 }, { label: '按钮类型', prop: 'type', type: 'select', options: [ { value: 'primary', label: 'primary' } ], }, { label: '按钮颜色', prop: 'color', type: 'colorPicker', }, { label: '是否为圆形按钮', prop: 'loading', type: 'switch', activeText: '是', inactiveText: '否' } ], data: '', // 组件数据绑定的组件属性 默认为value request: { // 组件数据绑定接口参数配置(不需要可以省略) type: '2', // 数据来源 1 mock 2 接口请求返回 method: 'GET', // 接口请求方式 result: [], // 接口请求返回数据 domain: '', // 请求接口域名 url: '', // 请求接口地址(除域名) series: false, // 是否定时发送请求 time: 1000, // 定时更新时间 requestCount: 0, // 请求次数限制,0 }, style: { // 组件样式 width: 110, height: 28, }, isExtend: true, // 是不是外部组件 scopedSlots: { // 组件solt {soltName: (h, p, arg)=> ;} h:渲染函数 p: 配置中propValue的参数 arg: 插件传参 title: (h, p, { item }) => h('div', {}, item[p.label]) }, on: { // 组件自定义事件 this.postMessage: 组件关联时传递出数据函数 this.propValue: propValue内的属性 this.request: request内属性 'tabChange': function(item){ this.postMessage({id: item[this.propValue.sign]}) } }, interfaces: { id: '' }, // 关联组件时传递接受的参数(必须是propValue内属性) } ```