Computed property was assigned to but it has no setter问题解决


Computed property was assigned to but it has no setter问题解决

提示此问题,是因为在computed 里面定义的属性 只有一个return返回。因为在其他地方进行了赋值操作,导致提示此错误!如下代码所示:

更改之前的代码:

 computed: {
            drCountData() {
                return this.$store.state.drCountData;
            },
        },

   
   
   
  • 1
  • 2
  • 3
  • 4
  • 5

解决办法:修改成如下的代码:

computed: {
            drCountData: {
                get(){
                    return this.$store.state.drCountData;
                },
                set(v) {
                    this.countData = v
                }
            }, 

   
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
https://blog.csdn.net/weixin_44994731/article/details/104302012


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM