sys.js 389 Bytes
import { defineStore } from 'pinia'

export const useAppStore = defineStore('sys', {
  state: () => ({
    isInBackground: false // 修正拼写错误:isInBackgound -> isInBackground
  }),
  actions: {
    setBackgroundState(value) {
      uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`)
      this.isInBackground = value // 直接修改 state
    }
  }
})