-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>
코드가 실행되는 경우, I (이 [ 'getListByPrice를']) CONSOLE.LOG 경우
일치하지 않는 도시 된 데이터가 존재 5 데이터. 내가 코드를 제거하면 그러나 5 개 이상의 데이터
을의 루프에 표시 :
<span>{{priceMin}} test {{priceMax}}</span>
결과는 올바른
내가 계산에 의해 priceMin 및 priceMax를 호출하는 경우, 같은 결과가 일치하지 않는 이유는 ?
언제'console.log'를 사용합니까? – imcvampire
Vuex 게터를 왜 감쌌습니까? 'options' 대신에'getListByPrice' 등을 사용할 수 있습니다. 정말로 원하는 경우 getter를 다른 이름으로 다시 매핑 할 수도 있습니다. 예를 들어'mapGetters ({options : 'getListByPrice', ...})' – Phil