Javascript 在一个if vuejs中写入2个条件
嗨,我有一个代码,我想把两个条件在一个如果。我的代码如下:Javascript 在一个if vuejs中写入2个条件,javascript,vue.js,vue-component,Javascript,Vue.js,Vue Component,嗨,我有一个代码,我想把两个条件在一个如果。我的代码如下: <img v-if="attribute.swatch_type == 'color'" class="thumb-product-select" style="width: 80px;height: auto" :src="'storage/' + option.images" alt="">
<img v-if="attribute.swatch_type == 'color'" class="thumb-product-select" style="width: 80px;height: auto" :src="'storage/' + option.images" alt="">
<span id="color_id_select" v-if='attribute.swatch_type == 'color' && option.images ='20.jpeg')"
:style="{ background: option.swatch_value }">
</span>
Property or method "option" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
found in
---> <ProductOptions>
检查你的报价&你错过了这里的双等于
option.images='20.jpeg
'
应该是
v-if="attribute.swatch_type == 'color' && option.images == '20.jpeg'"
'attribute.swatch_type=='color'&&option.images='20.jpeg'
->'attribute.swatch_type==''color'&&option.images='20.jpeg'
您提前关闭引号,因为您在所有地方都使用单引号。现在我得到了这个错误:赋值的左侧无效,如果我这样放置:v-if=“attribute.swatch_type=='color'”我的意思是单一条件可以正常工作option.images='20.jpeg'
这能回答你的问题吗?谢谢,伙计,我错过了你说的引语,因为这对我很有帮助,谢谢
v-if="attribute.swatch_type == 'color' && option.images == '20.jpeg'"