-1
マイVUE成分(第二成分):私は(これ[ 'getListByPriceを'])CONSOLE.LOG場合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>
コードが実行される場合、示されたデータは
と一致していない、あります5データ。
<span>{{priceMin}} test {{priceMax}}</span>
私が計算によってpriceMinとpriceMaxを呼び出す場合、示された結果が一致しないのはなぜ結果が
正しいです。しかし、私はコードを削除する場合は5つの以上のデータ
のループに示します?
いつ 'console.log'を使いますか? – imcvampire
なぜVuex gettersをラッピングしていますか? 'options'の代わりに' getListByPrice'などを使うこともできます。本当に必要な場合はgetterを別の名前に再マップすることもできます。たとえば 'mapGetters({options: 'getListByPrice'、...})' – Phil