1.1.67 • Published 6 years ago

starpost-ui v1.1.67

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

starpost-ui

A Vue2.0 UI Components for Web.

项目演示

演示地址

安装

npm install starpost-ui -S

使用

//ES6
import starpostUI from 'starpost-ui.js'

// require
var starpostUI = require('Starpost')

Vue.use(starpostUI)

// 或者直接使用script导入
<script src="https://unpkg.com/starpost-ui/dist/starpost-ui.js"></script>

sp-img 组件

<sp-img :urlArr="urlArr" @get-urlArr="getUrlArr" @active-index="getActiveIndex"></sp-img>
<sp-dialog :title="title" :visible.sync="visible">
  <sp-img-content :urlArr="spImgArr" :activeIndex="activeIndex" @active-index="getActiveIndex"></sp-img-content>
</sp-dialog>
<script>
export default {
  data () {
    return {
      visible: false,
      title: "",
      spImgArr: [],
      activeIndex: null, //当前展示图片的index
      urlArr: [
        {
          src: "http://pic2.97uimg.com/58pic/19/69/83/38658PICuUm.jpg!w1200",
          title: "标题1"
        },
        {
          src: "http://pic2.97uimg.com/58pic/21/56/66/15D58PICHdR.jpg!w1200",
          title: "标题2"
        },
        {
          src: "http://pic2.97uimg.com/58pic/18/23/47/56r58PICHN3.jpg!w1200",
          title: "标题3"
        }
      ]
    }
  },
  methods: {
    getUrlArr(val) {
      this.visible = true;
      this.spImgArr != val && (this.spImgArr = val);
    },
    //图片组件获取当前index
    getActiveIndex(index) {
      this.activeIndex = index;
      this.$nextTick(function() {
        this.title =
          this.spImgArr.length > 0 && this.spImgArr[index].title
            ? this.spImgArr[index].title
            : "标题";
      });
      console.log("图片组件获取当前index: " + index);
    }
  }
}
</script>

sp-dialo gAttribute

nameDescriptiontypedefault
title标题String''
visible是否打开Booleanfalse
width弹窗宽度String--
top顶部距离String'15vh'
footer弹窗底部是否显示Booleanfalse
scrollbar是否允许浏览器出现滚动条Booleanfalse
shadeClose是否点击遮罩关闭Booleanfalse

sp-dialo Events

事件名说明参数
open打开时触发--
close关闭时触发--

sp-img Attribute

nameDescriptiontypedefault
urlArr图片地址Array[]
showOne只展示第一张图片Booleanfalse
alignRow横排展示Booleantrue
imgSize展示图片大小Array30, 30

sp-img Events

事件名说明参数
active-index图片打开/切换时触发index值(当前index)
get-urlArr图片打开/切换时触发获取图片数组urlArr

sp-img-content Attribute

nameDescriptiontypedefault
urlArr图片数组Array[]
smallImgShow是否展示缩略图Booleantrue
imgSize缩略图图大小Array30, 30
defaultColor弹窗缩略图边框颜色String'#15A6BB'
cutBoxShow是否开启左右切换箭头Boolean'mouseenter'(可选'click')
switchEvent缩略图切换大图方式Booleanfalse
activeIndex当前展示图片的indexNumber0

sp-img-content Events

事件名说明参数
active-index打开/切换时触发index

Menu 菜单(无限循环)

<sp-menu-group
  :menuWidth="['40px', '200px']"
  :menuStatus.sync="status">
  <sp-menu :menus="menus"
    :menuStatus="status"
    :select-id="selectId"
    @select-id="getSelectId"/>
</sp-menu-group>
<script>
export default {
  data () {
    return {
      status: true,
      selectId: '1',
      menus: [{
        label: '一级 1',
        active: false,
        icon: 'icon-wutu',
        children: [{
          label: '二级 1-0',
          active: false,
          url:'#',
          children: [//如果使用权限,这样写,有url的children会转成configs数组,不会渲染出来,权限后台tree建议用element tree
            {'label': '新建'}
          ]
        },{
          label: '二级 1-1',
          active: false,
          children: [{
            label: '三级 1-1-1',
            active: false,
            url:'#'
          },{
            label: '三级 1-1-2',
            active: false,
            children: [{
              label: '4级 1-1-1-1',
              active: false,
              url:'#'
            }]
          }]
        }]
      }],
    }
  },
  methods: {
    //菜单选中的ID
    getSelectId(val) {
      this.selectId = val;
      console.log('选中的ID: '+ val);
    },
    menuOpen(val) {
      console.log("菜单组件 打开的ID: " + val);
    },
    menuClose(val) {
      console.log("菜单组件 关闭的ID: " + val);
    },
  }
}
</script>

Props

nameDescriptiontypedefault
menus菜单数组Array[]
backgroundColor背景颜色String'#222'
hoverBgColorhove背景颜色String'#000'
menuColor字体颜色String'#fff'
activeMenuColor选中改变字体颜色Arrayfalse, '#2e323e'
accordion是否开启手风琴模式Booleanfalse
width菜单尺寸String'200px'
height每行高度String'36px'
menuStatus菜单是否默认展开Booleantrue
router是否使用routerBooleanfalse
selectId选中的IDString''
pagePermissions是否开启页面权限功能Booleanfalse

Events

事件名说明参数
select-id选中的ID--
page-config获取页面权限配置--
open打开的ID--
close关闭的ID--

Amap 地图(高德)

<sp-amap :markers="markers" @get-map-form="getMapForm" @get-geocoder="getGeocoder"></sp-amap>
import VueAMap from 'vue-amap';

VueAMap.initAMapApiLoader({
  key: 'mykey',
  plugin: ['Autocomplete', 'PlaceSearch', 'Scale', 'OverView', 'ToolBar', 'MapType', 'PolyEditor', 'AMap.CircleEditor', 'AMap.Geolocation', 'Geocoder']
});

Vue.use(VueAMap);
<script>
export default {
  data () {
    return {
      markers: [
        {
          title: "东莞",
          position: [113.753228, 22.9833],
          phone: "13713262222"
        },
        {
          title: "龙岗",
          position: [114.234824, 22.723301],
          phone: "13713263333"
        },
        {
          title: "坂田",
          position: [114.07314, 22.62579],
          phone: "13713261111"
        }
      ],
    }
  },
  methods: {
    //返回数据及距离中心点最近的距离
    getMapForm(val) {
      console.log("选择仓库: " + JSON.stringify(val));
    },
    //获取经纬度:
    getGeocoder(val) {
      console.log("获取经纬度: " + JSON.stringify(val));
    },
  }
}
</script>

Props

nameDescriptiontypedefault
markers点信息Array[]
zoom地图显示的缩放级别Number9
width宽度String'500px'
height高度String'400px'

Events

事件名说明参数
getMapForm返回点数据--
getGeocoder返回经纬度--

Transfer 穿梭框(拖动)

<sp-transfer :data="transferData" @clear="clear" :callbakData.sync="callbakData" :title="['列表1', '列表2']" />
npm install -S vuedraggable
<script>
export default {
  data () {
    return {
      transferData: [
        { id: 1, label: "item1" },
        { id: 2, label: "item2" },
        { id: 3, label: "item3" },
        { id: 4, label: "item4" },
        { id: 5, label: "item5" }
      ],
      callbakData: []
    }
  },
  watch: {
    callbakData(val) {
      console.log("穿梭框数组:" + JSON.stringify(val));
    }
  }
}
</script>

Props

nameDescriptiontypedefault
data数组Array[]
callbakData返回的数组Array[]
title返回的数组Array"列表1", "列表2"
width宽度String'200px'
height高度String'300px'
stripe斑马线Booleanfalse
limit固定行数(每行支持多条)Booleanfalse
number行数Number5

Events

事件名说明参数
clear清空数据--

【全选/复选框】组件配置

<sp-checkbox
	:checkboxAll="true"
	:checkedArr="checkArr"
	v-model="checkAlled"
	@change="getCheckArr">全选&nbsp;&nbsp;
</sp-checkbox>
<sp-checkbox-group v-for="(item, index) in checkArr">
    <sp-checkbox
	  	v-model="item.checked"
	  	:checkedArr="checkArr"
	  	:checkAlled="checkAlled"
	  	@change="getCheckAlled">选项{{index}}
    </sp-checkbox>
</sp-checkbox-group>
<script>
export default {
  data () {
    return {
      checkAlled: false,
      checkArr: [
        { checked: false },
        { checked: false },
        { checked: false },
        { checked: false },
        { checked: false }
      ]
    }
  },
  methods: {
    getCheckArr(val){
        this.checkArr = val
    },
    getCheckAlled(val) {
        this.checkAlled = val
    }
  }
}
</script>

Props

nameDescriptiontypedefault
checkedArrchecked数组Array[]
checkboxAll是否为全选按钮Booleanfalse
checkAlled全选Booleanfalse
checkSizechecked大小Array14, 14

【单选/复选按钮】组件配置

<sp-checkbox-button
  :checkList="checkList"
  :checkValues="checkValues"
  @callback="getSaskStatus">
</sp-checkbox-button>
<script>
export default {
  data () {
    return {
      checkValues: ['01'],
      checkList: [
        {
          id: '01',
          name: '已付款',
        },{
          id: '02',
          name: '已发货',
        },{
          id: '03',
          name: '已签收',
        },
      ]
    }
  },
  methods: {
    //当前选中的值
    getSaskStatus(val) {
      this.checkValues = val;
      console.log('按钮 选中的值: '+val)
    },
  }
}
</script>

Props

nameDescriptiontypedefault
checkListchecked数组Array[]
checkValues默认选中项Array[]
checkMany是否为多选按钮Booleanfalse
checkboxSizechecked大小String'lg'
1.1.67

6 years ago

1.1.66

6 years ago

1.1.65

6 years ago

1.1.64

6 years ago

1.1.63

6 years ago

1.1.62

6 years ago

1.1.61

6 years ago

1.1.60

6 years ago

1.1.59

6 years ago

1.1.58

6 years ago

1.1.57

6 years ago

1.1.56

6 years ago

1.1.55

6 years ago

1.1.54

6 years ago

1.1.53

6 years ago

1.1.52

6 years ago

1.1.51

6 years ago

1.1.50

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago

1.0.1

7 years ago