出现原因:
  element-ui中 el-tab绑定的值在切换tab时会自动修改
  而activeTag是从store中获取的值,不能直接修改
  要添加给它绑定上set  
 
<el-tabs class="tags" v-model="activeTag" type="card" closable @tab-click="handleClick" @tab-remove="handleRemove">
  <el-tab-pane
    :key="item.id"
    v-for="item in tags"
  >
  </el-tab-pane>
</el-tabs>
 
报错情况
computed: {
  ...mapState({
    tags: state => state.tags,
    activeTag: state => state.activeTag
  }),
}
 
修改后:
computed: {
  ...mapState({
    tags: state => state.tags,
  }),
  activeTag: {
    get () {
      return this.$store.state.activeTag;
    },
    set (val) {
      this.$store.dispatch('changeActiveTag', val);
    }
  }
},

vue store获取值时 Computed property "activeTag" was assigned to but it has no setter.的更多相关文章

  1. vue报类似警告Computed property "isLoading" was assigned to but it has no setter

    一.原因:一个计算属性,当计算传入的是一个函数,或者传入的是一个对象,而没有设置 setter,也就是 set 属性,当你尝试直接该改变这个这个计算属性的值,都会报这个警告,vuex还会出现通过com ...

  2. django - request.POST和request.body获取值时出现的情况

    django request.POST / request.body 当request.POST没有值 需要考虑下面两个要求 1.如果请求头中的: Content-Type: application/ ...

  3. 解决vue更新默认值时出现的闪屏问题

    在Vue项目中,对于一个展示用户个人信息的页面.有以下需求,需要判断用户个人信息是否填充过,如果填充过,需要在页面中展示已填充项(未填充项不展示):如果未填充过,需要在页面中显示另外一种元素(提示用“ ...

  4. java.io.EOFException ValueOperations.increment()操作后,获取值时有的bug

    ---恢复内容开始--- 今天使用spring-data-redis包操作redis,就是简单的使用redis的计数功能,在redis中的操作命令如:incr key;get key; 这两步操作使用 ...

  5. Vue——解决报错 Computed property "****" was assigned to but it has no setter.

    在最近的项目中遇到了如下的警告信息: [Vue warn]: Computed property " currentStep" was assigned to but it has ...

  6. VUE通过索引值获取数据不渲染的问题

    问题:vue里面当通过索引值获取数据时,ajax数据成功返回,但是在火狐下不渲染 解决:

  7. vue 获取视频时长

    参考资料:js获取上传音视频文件的时长 直接通过element-ui自带的上传组件结合js即可,代码如下: HTML: <el-upload class="upload-demo&qu ...

  8. [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being

    [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent c ...

  9. vue报错 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's

    [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent c ...

随机推荐

  1. Linux安装jemalloc笔记

    前言 最近研究一个工具库需要用 jemalloc 做内存分配器,但在 ubuntu 下安装过程中遇到很多问题,故记下安装过程的笔记,避免以后遇到在这上面浪费时间. 安装过程 环境:VMware Ubu ...

  2. Mybatis 批量操作以及多参数操作遇到的坑

    查考地址:https://blog.csdn.net/shengtianbanzi_/article/details/80147134 待整理中......

  3. 2019上海网络赛 F. Rhyme scheme 普通dp

    Rhyme scheme Problem Describe A rhyme scheme is the pattern of rhymes at the end of each line of a p ...

  4. Ural 1238 Folding 题解

    目录 Ural 1238 Folding 题解 题意 题解 程序 Ural 1238 Folding 题解 题意 定义折叠.展开为: 单个大写英文字母是一个折叠的串,把它展开后是它本身. 如果\(S\ ...

  5. Python 闭包、迭代器、生成器、装饰器

    Python 闭包.迭代器.生成器.装饰器 一.闭包 闭包:闭包就是内层函数对外层函数局部变量的引用. def func(): a = "哈哈" def func2(): prin ...

  6. 【bitset】Kth Minimum Clique

    #include<bits/stdc++.h> #define B bitset<105> using namespace std; typedef long long ll ...

  7. 实例详解jQuery的无new构建

    jQuery的无new构建 jQuery框架的核心就是从HTML文档中匹配元素并对其执行操作. 回想一下使用 jQuery 的时候,实例化一个 jQuery 对象的方法: // 无 new 构造 $( ...

  8. python 定时爬取内容并发送报告到指定邮箱

    import requests import smtplib import schedule import time from bs4 import BeautifulSoup from email. ...

  9. SWATS算法剖析(自动切换adam与sgd)

    SWATS算法剖析(自动切换adam与sgd) 战歌指挥官 搬砖.码砖.代查水表.... 27 人赞同了该文章 SWATS是ICLR在2018的高分论文,提出的一种自动由Adam切换为SGD而实现更好 ...

  10. TCP协议探究(三):RTT、滑动窗口和阻塞处理

    1 RTT算法 1.1 概述 上一节说了重传机制需要设置一个重传超时值(RTO,Retransmission TimeOut),RTO设长了,重发太慢:设短了,可能导致包没有丢,就重发了,可能导致雪崩 ...