iOS: update horizontal list beforeDragging & add itemCanDrag

This commit is contained in:
王劲鹏
2022-09-01 10:19:18 +08:00
committed by osborn
parent a452cde882
commit ef4eb4d517
2 changed files with 60 additions and 14 deletions

View File

@@ -66,11 +66,21 @@ class ListVM extends ViewModel<ListModel, ListVH> {
onAttached(state: ListModel, vh: ListVH) {
vh.list.apply({
canDrag: true,
itemCanDrag: (from) => {
if (from === 0) {
return false;
} else {
return true;
}
},
beforeDragging: (from) => {
return [0, 1, 2]
},
onDragging: (from, to) => {
log(`onDragging, from: ${from}, to: ${to}`)
loge(`onDragging from: ${from}, to: ${to}`)
},
onDragged: (from, to) => {
log(`onDragged, from: ${from}, to: ${to}`)
loge(`onDragged from: ${from}, to: ${to}`)
},
renderItem: (index) => {
const data = state.data[index]