Skip to content
On this page

组件库文档 tmui.design

列表拖动排序 DragList

通过该组件快速实现用户自定义排序功能。


🌶️ 列表拖动排序 DragList 示例

查看模拟效果
示例模板
vue
<template>
    <tm-app>

        <tm-sheet>
            <tm-text :font-size="24" _class="font-weight-b" label="长按图标开始拖动"></tm-text>
        </tm-sheet>

       <tm-drag-list :list="lsit"></tm-drag-list>

    </tm-app>
</template>
<script lang="ts" setup>
import { ref, getCurrentInstance } from "vue"
import { onShow, onLoad } from "@dcloudio/uni-app";
import tmApp from "@/tmui/components/tm-app/tm-app.vue"
import tmSheet from "@/tmui/components/tm-sheet/tm-sheet.vue"
import tmText from "@/tmui/components/tm-text/tm-text.vue"
import tmDragList from "@/tmui/components/tm-drag-list/tm-drag-list.vue"
import tmFilterMenu from "@/tmui/components/tm-filterMenu/tm-filterMenu.vue"
import tmFilterMenuItem from "@/tmui/components/tm-filterMenu-item/tm-filterMenu-item.vue"
const showWin = ref(false)
const pos = ref("bottom")
const lsit = ref([
    {text:"测试项目1-1"},
    {text:"测试项目2-1"},
    {text:"测试项目3-1"},
    {text:"测试项目4-1"},
    {text:"测试项目5-1"},
])

</script>

🌶️ 兼容性

APP-VUEAPP-NVUE小程序WEB/H5VUE3/TS
✔️✔️✔️✔️

🌱 参数

参数名类型默认值描述
disabledBooleantrue是否禁用
widthNumber90宽度
heightNumber700高度
list[itemList][]列表数据(格式见下方说明)
rangKeyStringtext
rightIconStringicon-menu右侧图标
bgColorStringwhite背景颜色
  • 主体内容数据参数
javascript
itemList{
    _id:number|string,//内部标识
    top:number|string,
    i:number|string,
    text:number|string,//项目文字
    icon:string,//项目图标,左边
    color:string,//文字颜色
    [prop:string]:any
}

🌹 事件

事件名参数返回数据描述
changelistData排序后的数组数据排序变更触发

🥗 ref方法

💏 文档贡献

此页文档由Kyour贡献,如果对该框架感兴趣的可以参与我们一同进步!