Files
pj_plan_cloud/src/components/notification/useList.js
T
2025-10-17 13:01:55 +08:00

24 lines
470 B
JavaScript

import { ref } from "vue";
let count = 0;
const useList = () => {
const notificationList = ref([]);
const add = (optionProps) => {
notificationList.value.push({ id: count++, ...optionProps });
};
const remove = (id) => {
notificationList.value = notificationList.value.filter((item) => item.id !== id);
};
const clear = () => {
notificationList.value = [];
}
return { notificationList, add, remove, clear };
};
export default useList;