vue2.5.6 升级之后组件传输参数的方式发生了变化 polation inside attributes has been removed

场景

vue升级到2.5.6之后传递参数到组件汇报这样的错误

分析

1. 从提示分析,版的和参数方式不再支持 需要采用新的方式 

Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead。For example, instead of <div style="{{ val }}">, use <div :style="val">.

2.  组件传递的参数 color
  旧版本的写法 `style="background:{{ color }}"` color='red'
3 .  新版的写法 
<button v-on:click="count += 1" v-bind:style="'background:' + color"  class="btn btn-default" >{{ count }}</button>

猜你喜欢

转载自blog.csdn.net/cominglately/article/details/80218999