计算属性怎么传参?<ul> <li v-for="item in goods" :style="goodsType" v-text="item.name"></li></ul>data: { goods: [{ id: 2, type: 3, name: '薯片' },{ id: 3, type: 5, name: '冰红茶' }]},computed: { goodsType: function(type){ switch (type) { case 3: return "color: #ff9900" break; case 5: return "color: #00BC0C" break; } }}
添加回答
举报
0/150
提交
取消