Condition in v-bind:Style - VueJS

后端 未结 8 2204
遥遥无期
遥遥无期 2020-12-23 19:28

I have an easy question for which I hope you could help:

8条回答
  •  感情败类
    2020-12-23 20:12

    If you're iterating through an object, you can use a method. In such cases when the style is dependent on a property in the object, this is the only option I have found .... none of the options above work.

    ... data () { return { item: { featured_photo: null } } }, methods: { background (thing) { return thing ? 'red' : 'black'` } }

提交回复
热议问题