mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-11 11:46:38 +08:00
34 lines
640 B
JavaScript
34 lines
640 B
JavaScript
import { defineStore } from "pinia";
|
|
const chatStore = defineStore("notice", {
|
|
state: () => ({
|
|
noticeList: []
|
|
}),
|
|
getters: {
|
|
noticeForNoReadCount:(state)=>{
|
|
return state.noticeList.filter(x => x.isRead ==false).length;
|
|
}
|
|
|
|
},
|
|
actions:
|
|
{
|
|
addNotice(msg) {
|
|
this.noticeList.unshift(msg);
|
|
},
|
|
addNotices(msgs) {
|
|
|
|
msgs.forEach(item => {
|
|
this.addNotice(item);
|
|
});
|
|
},
|
|
setNotices(msgs) {
|
|
this.noticeList=msgs;
|
|
},
|
|
removeNotice(id)
|
|
{
|
|
this.noticeList = this.noticeList.filter(obj => obj.id != id);
|
|
}
|
|
},
|
|
});
|
|
|
|
export default chatStore;
|