1.0.10 • Published 5 years ago

vue-remove-simple v1.0.10

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

基于vue开箱即用的全局左滑删除(包含长按事件)的回调
下图gif可能有卡顿,图片原地址

+路过来个star鼓励下

npm.io

使用方法

首先在项目中安装:npm install vue-remove-simple -S
//main.js
import Remove from 'vue-remove-simple'
Vue.use(Remove)

<template>
    <remove @longpress="longpress(0)" @callback="callback(0)">
        <div style="height:50px;line-height:50px;border-bottom:1px solid #ccc">
            数据1
        </div>
    </remove>
    <remove @longpress="longpress(1)" :nextBtn="'标记'"  @callback="callback(1)" @nextCallback="nextCallback(obj)">
        <div style="height:50px;line-height:50px;border-bottom:1px solid #ccc">
            数据2
        </div>
    </remove>
</template>
<script>
export default {
    data() {
        return {
            obj:{name:'张三'}
        };
    },
    methods:{
        longpress(num){
            alert("你长按了"+num)
        },
        callback(num){
            alert("你点击了删除"+num)
        },
        nextCallback(obj){
            alert("hello:"+obj.name)
        }
    }
}
</script>

操作按钮的style参数

PropDefaultTypeDescription
btn删除String第一个按钮
color#fffString删除按钮的颜色
backgroundredString删除按钮的背景色
nextBtnnoneString如果需要第二个按钮(比如上图的标记已读),不填写默认不生成第二个按钮
nextColor#fffString第二个按钮的颜色
nextBackground#cccString第二个按钮的背景色

操作按钮的回调函数

PropDefaultTypeDescription
callbacknoneFunction删除按钮的回调
nextCallbacknoneFunction第二个按钮的回调
longpressnoneFunction支持长按内容区域的回调

也可以在main.js中统一设置

支持设置删除按钮的{background:'',btn:'',color:''}如果需要第二个按钮,可以设置{nextBtn:'XXX',nextBackground:'',nextTwo:''}

Vue.use(Remove,{......})


github链接 链接名称

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago