UNPKG

tav-ui

Version:
29 lines (24 loc) 942 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); function useSelectRecords() { const selectRecordsRef = vue.ref([]); const selectRecords = vue.computed(() => vue.unref(selectRecordsRef)); function setSelectRecords(selectRecords2, type) { if (type === "normal") { const prevSelectRecords = vue.unref(selectRecordsRef); const currentSelectRecords = selectRecords2.reduce((result, cur) => { const isHaveSameOption = result.find((option) => option.idPath === cur.idPath); !isHaveSameOption && result.push(cur); return result; }, prevSelectRecords); selectRecordsRef.value = currentSelectRecords; } if (type === "recover") { selectRecordsRef.value = selectRecords2; } } return { selectRecords, setSelectRecords }; } exports.useSelectRecords = useSelectRecords; //# sourceMappingURL=use-select-records2.js.map