-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