鍍金池/ 問答/HTML/ 在餓了嗎的項(xiàng)目中,shopcart 組件顯示不了數(shù)據(jù),我已經(jīng)在外層的app.vu

在餓了嗎的項(xiàng)目中,shopcart 組件顯示不了數(shù)據(jù),我已經(jīng)在外層的app.vue加了seller屬性為什么還是不了呢??

在goods.vue中:

clipboard.png

在shopcart.vue中

clipboard.png

在外層的app.vue中

clipboard.png

我已經(jīng)在app。vue加入了 :seller="serller"屬性了,為什么還是沒有定義minPrice??

有以下的錯(cuò)誤:

clipboard.png

回答
編輯回答
櫻花霓
  1. app.vue 傳遞,good.vue 接收:

    export default {
        props: {
              seller: {
                type: Object
              }
        }
     }
  2. good.vue 傳遞,shopcart.vue 接收

    export default {
        props: {
              deliveryPrice: {
                type: Number,
                default: 0
              },
              minPrice: {
                type: Number,
                default: 0
              }
            }
     }
2017年2月25日 01:45
編輯回答
鐧簞噯

deliveryPrice還有minPrice是你為shopcart定義的屬性,需要接收

<shopcart :deliveryPrice="seller.deliveryPrice" :minPrice="seller.minPrice"></shopcart>

shopcart 里接收

export default {
             props:{
                 deliveryPrice:{
                    type:String,
                       default:'100'
                },
                 minPrice:{
                    type:String,
                       default:'100'
                }
             },
         }
2017年11月1日 09:04
編輯回答
硬扛

在shopcart.vue里面要聲明一個(gè)props minPrice,沒有告訴它它不會(huì)去接收父組件傳遞過來的數(shù)據(jù)

2017年6月21日 19:26
編輯回答
未命名

已經(jīng)解決了,謝謝各位好人了

2018年1月12日 04:38