Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在一个if vuejs中写入2个条件_Javascript_Vue.js_Vue Component - Fatal编程技术网

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'"