1.1.17 • Published 3 years ago

frame-selection v1.1.17

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

frame-selection

一个vue框选功能插件,支持点击和拉框选中

GitHub项目地址

欢迎留言沟通: 13676373110@163.com

demo演示

npm.io

使用

  • npm install frame-selection //安装包资源

全局注册方式

    //main.js中引入
    import frame-selection from 'frame-selection'
    Vue.use(frame-selection)
    //*.vue中 直接使用
    <frame-selection 
        :AxisX="AxisX" 
        :AxisY="AxisY" 
        @selectCell="getData" >
    </frame-selection>
    export default {
        data() {
            return {
                AxisX:[1,2,3],
                AxisY:[100,200,300]
            }
        },
        methods:{
            // 当选中格子时触发
            getData(value){
                console.log(value)
            }
        }
    }

单独使用

    //*.vue中 直接使用
    <template>
        <frame-selection 
            :AxisX="AxisX" 
            :AxisY="AxisY" 
            @selectCell="getData" >
        </frame-selection>
    </template>
    // 引入组件
    import FrameSelection from 'frame-selection'
    export default {
        data() {
            return {
                AxisX:[1,2,3],
                AxisY:[100,200,300]
            }
        },
        methods:{
            // 当选中格子时触发
            getData(value){
                console.log(value)
            }
        },
        // 注册组件
        components:{
            FrameSelection,
        }
    }

Options && Methods

Options

属性说明例子默认值
cellWidth每个小格子的宽度 (Number)1717
cellHeight每个小格子的高度 (Number)1717
maxWidth格子区域的最大宽度,超出产生滚动条(Number)200200
maxHeight格子区域的最大高度,超出产生滚动条(Number)200200
title功能提示信息(String)高度/时间
AxisXX轴方向数据列表(Array)01,02,03
AxisYY轴方向数据列表(Array)100,200,300
defaultSelectCellBox设置默认 已选择的格子(Array)[01,100,01,200,01,300]
usableBox设置默认 可选择的格子,默认全部可选(Array)"01,200","02,100"全部可选
clearBtn是否显示清空按钮falsefalse

Methods

事件名称说明参数
selectCell当参数被选中或者取消时触发当前选中的值(Array)
mousedownMethods当鼠标按下时触发event
mouseupMethods当鼠标抬起时触发event
mouseleaveMethods当鼠标离开区域时触发event
clearAll点击清空按钮触发

二次开发

  • npm install //安装node运行环境

  • npm run dev //启动项目

  • npm run build //打包项目

仓库地址

GitHub项目地址https://github.com/HuXiaoTu/frame-selection

目录结构描述

    ├─assets                    静态文件
    └─frameSelection            组件所在区域

V1.1.0 版本内容更新

  1. 增加事件回调函数

V1.1.9 版本内容更新

  1. 修改传参方式 优化代码

V1.1.15 版本内容更新

  1. 优化数据结构
  2. 增加最大高度定义参数

V1.1.17 版本内容更新

  1. 增加清空按钮&&清空事件
1.1.17

3 years ago

1.1.16

3 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago