Error Unexpected side effect in "listShow" computed property

Why does this problem arise and how can it be solved?
clipboard.png

       listShow () {
        if (!this.totalCount) {
          this.fold = true;
          return false;
        }
        let show = !this.fold;
        if (show) {
          this.$nextTick(() => {
            if (!this.scroll) {
              this.scroll = new BScroll(this.$refs.listContent, {
                click: true
              });
            } else {
              this.scroll.refresh();
            }
          });
        }
        return show;
      }
Apr.29,2021

listShow is a computational attribute, which cannot be written directly. You need to use get and set, because some of the values have been modified.
both the toggleList and empty methods need to be modified.
there may be a better way, for reference only.

computed: {
  listShow: { // 
    get () {
      if (!this.totalCount) { //  0 
        return false
      }
      return this.fold
    },
    set () {
      if (!this.totalCount) {
        this.fold = false
      }
      if (!this.fold) {
        this.$nextTick(() => {
          //  better-scroll  refresh
          if (!this.scroll) {
            this.scroll = new BScroll(this.$refs.listContent, {
              click: true
            })
          } else {
            this.scroll.refresh()
          }
        })
      }
    }
  }
},
methods: {
  // 
  toggleList () {
    if (!this.totalCount) {
      return
    }
    this.listShow = false //  better-scroll  refresh
    this.fold = !this.fold //  this.fold  lisShow
  },
  // 
  empty () {
    this.selectFoods.forEach((food) => {
      food.count = 0
    })
    this.listShow = false // 
  },
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9a8bd-68f57.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9a8bd-68f57.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?