在最近的项目中遇到了如下的警告信息:

   [Vue warn]: Computed property " currentStep" was assigned to but it has no setter.(意思是:计算属性 currentStep被赋值了,但此它并未定义 set方法 。)

  要解决这个问题,首先要明确这个问题出现的原因。这个警告是由于Vue的计算属性内部没有set方法,即:计算属性不支持值得修改(只能针对data中的值进行计算)。

  

data(){
return {
stepMap:0
}
},
computed:{
currentStep:{
get(){
return this.stepMap
},
set(v){
this.stepMap = v
}
// set方法只写下面这一行也是可以的
// set(){}
}
}

  如上面所示,只要手动给计算属性添加get和set方法的不同操作,这个警告就解决了。

Vue——解决报错 Computed property "****" was assigned to but it has no setter.的更多相关文章

  1. vue 解决报错1

    [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available ...

  2. Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

    Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' ...

  3. 【整理】解决vue不相关组件之间的数据传递----vuex的学习笔记,解决报错this.$store.commit is not a function

    解决vue不相关组件之间的数据传递----vuex的学习笔记,解决报错this.$store.commit is not a function https://www.cnblogs.com/jaso ...

  4. vue 项目报错,提示:Cannot read property '$createElement' of undefined at render ...

    vue 项目报错,提示:Cannot read property '$createElement' of undefined at render ...

  5. vue IE 报错 引用babel-polyfill

    一.vue 项目报错 vuex requires a Promise polyfill in this browser     在网上找到下面三篇文章,然而和我的项目都不太一样. 我的项目基于 基础模 ...

  6. 【转】Vue项目报错:Uncaught SyntaxError: Unexpected token <

    这篇文章主要介绍了Vue项目报错:Uncaught SyntaxError: Unexpected token <,在引入第三方依赖的 JS 文件时,遇到的一个问题,小编觉得挺不错的,现在分享给 ...

  7. vue runtime报错问题

    Webpack中导入vue和普通网页中导入vue的区别1. 普通网页导入vue方式 <script></script> 2. Webpack导入vue方式 Import Vue ...

  8. 解决报错:axios is not defined

    好家伙,来解决报错:axios is not defined 写前端嘛,修bug,不寒颤 进入页面一片空白 来看看报错: 1.axios在安装时:npm install axios --save-de ...

  9. Vue.js报错Failed to resolve filter问题原因

    Vue.js报错Failed to resolve filter问题原因 金刚 vue Vue.js js javascript 之前使用vue.js写分页功能时,写了一个过滤器,发现一个比较奇怪的错 ...

随机推荐

  1. Go_goroutine初识

    package main import ( "fmt" ) func main() { /* 一个goroutine打印数字,另外一个goroutine打印字母,观察运行结果.. ...

  2. linux 配置php环境变量

    vim /etc/profile //加上 export PATH=$PATH:/usr/local/php/bin 保存退出 source /etc/profile php -v 注:该配置对所有用 ...

  3. python 读写函数

    1.open 使用open打开文件后一定要记得调用文件对象的close()方法.比如可以用try/finally语句来确保最后能关闭文件. file_object = open('thefile.tx ...

  4. 各种颜色空间之间的转换算法(XYZ → Standard-RGB ,Standard-RGB → XYZ)

    http://www.easyrgb.com/en/convert.php#Result http://www.easyrgb.com/en/math.php

  5. 13,viewport

    set viewport:~是一种函数,功能是为图形输出设置当前视口. 怎样处理移动端1px被渲染成2px的问题(略)

  6. 12306 selenium 模拟登录

    # 下面是12306 实现的模拟登陆 # 解码 应用超级鹰,注册用户,左侧栏软件ID进去,开启一个新软件,拿到软件ID # 下面测试都在jupyter里面实现 # 超级鹰类 cell import r ...

  7. P2141

    总算过了,看了题解才知道是因为重复的不算,比如 1 + 4.4 + 1.2 + 3.3 + 2 都是重复,也就是结果相同的不同的两个数只能出现一组.于是加上判断就好. #include <bit ...

  8. Python实现mysql数据库增删改查

    利用python操作mysql数据库用法简单,环境配置容易,本文将实现对库增.删.改.查的简易封装!   1. 环境配置 安装第三方包  ,导入模块 mysql.connector  pip inst ...

  9. EF 查询表达式 join

    数据源: 1.无into,相当于 inner join var query = from p in context.P join s in context.S on p.PID equals s.PI ...

  10. LeetCode练题——88. Merge Sorted Array

    1.题目 88. Merge Sorted Array——Easy Given two sorted integer arrays nums1 and nums2, merge nums2 into  ...