cmc-web/packages/common/hooks/useSelection.js

22 lines
541 B
JavaScript
Raw Normal View History

2024-08-20 12:11:31 +00:00
/*
* @Author: Haijun Zhang
* @Date: 2022-11-03 15:41:09
* @LastEditTime: 2022-12-08 15:37:40
* @LastEditors: Haijun Zhang
* @Description:
* @FilePath: \cmc-web\packages\common\hooks\useSelection.js
*/
import { ref, computed } from 'vue'
export default function() {
const selections = ref([])
function handleSelectionChange(selection) {
selections.value = selection
}
const selectionIds = computed(() => selections.value.map((item) => item.id))
return {
selectionIds,
selections,
handleSelectionChange
}
}