0.1.5 • Published 3 years ago

lsl-element v0.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

安装使用

  • yarn add R-element / npm install R-element --save

全局使用

  • import RElement from "R-element";
  • import "R-element/lib/R-element.css"; (如果不使用编辑器工具可以不导入)
  • vue.use(RElement);

RCommonTable使用

   <R-Commontable
      border
      stripe
      :data="data"
      height="580"
      :column="column"
      pagination
      v-loading="loading"
      :total="page.total"
      :page="page.currentPage"
      :limit="page.limit"
      @pagination="paginationChange"
    ></R-Commontable>

    // 在data中进行表格相关的配置,支持所有原生element属性
   data() {
    return {
      column: [
        {
          label: "模块说明",
          align: "center",
          prop: "desc",
          "show-overflow-tooltip": true,
          width: 400,
        },
        {
          label: "模块参数",
          align: "center",
          prop: "params",
          render: (h, scope) => {
            return <el-tag>{scope.row.address}</el-tag>;
          },
        },
      ],
    };
  },

commonTableApi

propsdesc功能
column表格所需的字段和和属性,属性支持elementui table所有属性可通过render自定义行列组件
pagination是否需要分页@pagination分页改变时回调
其他属性和elementui一致

RCommonForm

html
 <R-Commmonform ref="myform" :formOptions="createFormOption" />
  <el-button type="primary" @click="submitForm('myform')">立即创建</el-button>
配置
createFormOption: {
        'labelWidth': '100px',
        getForm: (values) => {
          console.log('获取form元素的值', values);
        },
        formOption: [
        {
          label: "工作流名称",
          type: "input",
          value: "",
          props: {
            style: {
              width: "330px",
            },
            blur: (e) => {
              console.log("失去焦点", e);
            },
          },
          isRequired: true,
        },
        {
          label: "工作流描述",
          type: "textarea",
          value: "",
          props: {
            rows: 5,
            style: {
              width: "330px",
            },
          },
          isRequired: true,
          rule: [{ required: true, message: "112121", trigger: "blur" }],
        },
        {
          label: "下拉选择",
          type: "select",
          value: "",
          props: {
            options: [
              {
                value: "选项1",
                label: "黄金糕",
              },
              {
                value: "选项2",
                label: "双皮奶",
              },
            ],
            change: (e) => {
              console.log(e);
            },
          },
          isRequired: true,
        },
        {
          label: "日期范围选择",
          type: "dateRange",
          props: {
            start: {
              value: "2021-04-27",
              change: (e) => {
                console.log("选择时间", e);
              },
            },
            end: {
              value: "2021-04-27",
            },
          },
        },
        {
          label:"开关",
          type: "switch",
          value: true
        },
        {
          label: "多选框",
          type: "checkbox",
          value: ["线下主题活动"],
          props: {
            options: [
              "美食/餐厅线上活动",
              "地推活动",
              "线下主题活动",
              "单纯品牌曝光"
            ]
          }
        },
        {
          label: "单选框",
          type: "radio",
          value: "男",
          props: {
            options: [
              "男",
              "女"
            ]
          }
        }
      ]
      }
form校验
    submitForm(formName) {
      // 校验form
      const form = this.$refs[formName];
      form.validateForm().then(res => {
        console.log("validate", res);
      })
    }

commomformApi

propsdesc
labelWidth表单域标签的宽度同elementui form label-width
getForm获取表单所有值集合返回一组{lable:value}
props需要传给控件的属性具体可参考上面示例

表单支持类型 |type|desc|prop| |-|-|-| |input|输入框|同elementui input| |textarea||同elementui textarea| |select|下拉选择|| |datePicker|日期选择|| |dateRange|日期范围选择|| |switch|开关|| |checkbox|多选框|| |radio|单选框||

RCommonDialog

示例
 <!-- <R-CommonDialog :visible.sync="dialogVisible" type="form" :formOptions="createFormOption" /> -->

    <R-CommonDialog title="tableDialog" :visible.sync="dialogVisible" type="table" :column="column" />
   createFormOption: {
        labelWidth: "100px",
        getForm: (values) => {
          console.log(values);
        },
        formOption: [
          {
            label: "工作流名称",
            type: "input",
            value: "",
            props: {
              style: {
                width: "330px",
              },
              blur: (e) => {
                console.log("失去焦点", e);
              },
            },
            isRequired: true,
          },
]
}

commonDialogApi

目前封装弹框只有镶嵌form和table两种,其他情况 直接使用
typedesc
form支持commonform所有配置和属性需申明type="form"
table支持commontable所有配置和属性需申明type="table"
其他情况slot name="content"例如div slot="content"

RCommonPage

  • 封装了一些固定页面样式,方便统一书写页面
示例
<R-CommonPage>
<div slot="Breadcrumb">
  Breadcrumb/面包屑
</div>

 <div slot="content">
  内容区域
 </div>
</R-CommonPage>

RHandlebtns

方便表格操作栏按钮书写

<HandleBtns btnOptions={options} />

options = [
{
  content: "编辑",
  icon: "el-icon-edit",
  type: "info",
  click: () => {}
}
]
propdesc
btnOptions所有按钮对象数组Array
content功能描述鼠标放上去显示的文字
iconelement ui icon目前只支持了element ui的icon
typeelement ui button typeinfor,default,success,warning等
click点击了图标回调

markdown编辑器

使用

<RMarkeditor style="width: 100%;" />

markdown编辑器是参考集成mavon-editor,感谢作者,使用方法

还有部分组件文档后续在写

0.1.4

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago