import { defineStore } from 'pinia'

export const usePaperStore = defineStore(
  'paperId',
  {
    state() {
      return {
        paperId: null
      }
    },
    actions: {
      setParams(paperId) {
        this.paperId = paperId
        // 保存参数到 localStorage
        localStorage.setItem('paperId', paperId)
      },
      loadParamsFromStorage() {
        // 从 localStorage 加载参数
        this.paperId = localStorage.getItem('paperId')
      }
    }
  },
  {
    persist: true // 启用持久化
  }
)
