1.2.6 • Published 4 years ago

@cui_xl/sning v1.2.6

Weekly downloads
10
License
MIT
Repository
-
Last release
4 years ago

sning 使用说明

项目常用组件抽取封装,仅针对特殊业务情况。

安装

npm i @cui_xl/sning

引入

整体引入

import sning from '../packages/index'
Vue.use(sning)

单个组件按需引入

import {
  SningLayout,
  SningTdChart
} from '../packages/index'
Vue.use(SningLayout)
Vue.use(SningTdChart)

组件列表

SningLayout

用于生成页面UI框架

使用方式

<sning-layout :no-header="false"
          :no-sidebar="false"
          :header-fixed="true"
          :sidebar-fixed="true"
          :sidebar-collapsed="true"
          :sidebar-collapsed-type="'top'"
          :defaultSidebarCollapsed="true"
          :side-menu="menu">
          <md-header slot="header"/>
          <router-view />
  </sning-layout>

配置

sning-layout

属性类型默认值描述
typeStringtop布局结构,top 为上下结构,side 为左右结构
no-headerBooleanfalse隐藏头部
no-sidebarBooleanfalse隐藏侧边栏
header-fixedBooleantrue头部是否固定
sidebar-fixedBooleantrue侧边栏是否固定
sidebar-collapsedBooleanfalse侧边栏是否可收缩
sidebarCollapsedTypeStringtop可选值topside
defaultSidebarCollapsedBooleanfalse默认侧边栏收缩,默认展开
side-menuArray[]侧边栏列表
titleString--头部标题
subTitleString--侧边栏顶部标题

side-menu 侧边栏菜单每项的属性,参考uxcool的menu配置

属性类型默认值描述
keyString--唯一标记
nameString--label
iconString--图标(仅支持xu-cool icon)
pathString--菜单路由名
typeString--submenu
childrenArray--子菜单列表, 父级添加type: 'submenu'
showBooleanfalse是否显示

slot 插槽

属性描述
header自定义头部
sidebar自定义侧边栏

SningTdChart

使用 echart + ux-table 生成图和表格的数据展示形式

使用方式

<ux-row :gutter="20">
  <ux-col v-for="(item, idx) in list"
          :key="idx"
          :span="item.span"
          :style="{height: item.height}">
    
    <sning-td-chart :params="item.params"
                :name="item.name"
                :struct="item.struct"
                :unit="item.unit"
                :xAxisData="item.xAxis"
                :seriesData="item.seriesData"
                :chartHeight="item.chartHeight"
                :tableHeight="item.tableHeight"
                :tableScrollHeight="item.tableScrollHeight"
                :chartWidth="item.chartWidth"
                :tableWidth="item.tableWidth"
                :showMsg="item.showMsg"
                :columns="item.columns"
                :tableData="item.tableData"
                :tooltipInfo="item.tooltipInfo"/>
    <br>
  </ux-col>
</ux-row>

参数

属性类型默认值描述
nameString--图表标题
paramsString--图表入参
spanNumber--结合ux-rowux-col设置比例
tooltipInfoString''对标题进行说明的tooltip
columnsArray--ux-table 表头列,[{key: '', title: ''}]
tableDataArray--ux-table 数据
chartHeightString'220px'图的高度, struct 为 up-down 时有效
tableHeightString'100px'表的高度, struct 为 up-down 时有效
tableScrollHeightNumber50ux-table 滚动高度
structStingup-down图表展示结构,up-down 上下结构, left-right 左右结构
xAxisArray[]图x轴数据
seriesDataArray[]数组的每项是一个对象,{name: '', data: []}
unitString''数据单位
chartWidthString60%图的宽度
tableWidthString40%图的宽度