-1
我VUE组分(第二组分)所示:如何在vue.js 2中运行一些计算?
<template>
<div class="row">
<div v-for="item in options">
<div class="panel panel-default panel-product">
....
</div>
</div>
<div>
<a href="#" class="panel-more">
<span>{{priceMin}} test {{priceMax}}</span>
</a>
</div>
</div>
</template>
<script>
...
export default {
...
computed: {
...mapGetters([
'getListByPrice', 'getPriceMin', 'getPriceMax'
]),
options() {
return this['getListByPrice']
},
priceMin() {
return this['getPriceMin']
},
priceMax() {
return this['getPriceMax']
},
},
...
}
</script>
如果代码执行时,示出不匹配
如果我CONSOLE.LOG(此[ 'getListByPrice'])的数据,有5数据。但是,在超过5个数据
的循环中。如果我删除代码:
<span>{{priceMin}} test {{priceMax}}</span>
的结果是正确的
为什么如果我叫priceMin和priceMax通过计算,显示的结果不匹配?
你什么时候使用'console.log'? – imcvampire
你为什么要包裹Vuex吸气剂?你可以使用'getListByPrice'等代替'options',甚至可以将getter重映射到另一个名字,例如'mapGetters({options:'getListByPrice',...})' – Phil