vue
肖末末
fighting!!!
展开
-
【vue warning】avoid mutating a prop directly
问题描述使用props,通过父组件给子组件传值,子组件在使用props中的属性时,直接对props中的属性进行了修改。(props单向数据流)解决方案1、子组件在data定义属性来接受props属性值(子组件改变值就不会影响props)2、双向绑定,子组件改变值,则使用$emit改变props的值...转载 2020-12-30 17:12:52 · 116 阅读 · 0 评论 -
vue 动态绑定class
多种判断动态绑定class<div :class="{redColor:isShow}"></div><div :class="{ redColor:type==0, buleColor:type==1, yellowColor:type==2 }"></div><div :class="isShow?'redColor':'buleColor'"></div>&l原创 2020-12-30 17:02:16 · 167 阅读 · 0 评论