组件
排序列表 Order List
OrderList:可排序列表。行可以通过拖柄或侧边箭头移动,组把新顺序作为值上报,模型就是顺序。拖拽使用原生 drag 事件,primary 墨色发丝线标记行将落入的位置;触屏则通过按钮排序。
#基础用法
- Prelude
- Fugue
- Interlude
- Coda
<script setup lang="ts">
import { OrderList } from "@bysages/vue";
import { ref } from "vue";
const options = [
{ label: "Prelude", value: "prelude" },
{ label: "Fugue", value: "fugue" },
{ label: "Interlude", value: "interlude" },
{ label: "Coda", value: "coda" },
];
const value = ref(options.map((option) => option.value));
</script>
<template>
<div class="flex w-80 flex-col gap-3">
<OrderList v-model="value" :options="options" label="Movements" />
<output class="text-xs text-tertiary">{{ value.join(" → ") }}</output>
</div>
</template>
#属性
#OrderList
OrderList:可排序列表。行可以通过拖柄或侧边箭头移动,组把新顺序作为值上报,模型就是顺序。拖拽使用原生 drag 事件,primary 墨色发丝线标记行将落入的位置;触屏则通过按钮排序。
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
modelValue | Array as PropType<string[]> | 按当前顺序排列的行;值的顺序就是行的顺序 | |
options | Array as PropType<OrderOption[]> | 可显示的全部行,不保证顺序 | |
label | String | undefined | — |