[英]Accessing data in vue component
我試圖訪問一些我綁定到組件的數據,但是沒有運氣。 我應該怎么做?
我的組件:
export default {
name: 'component-vallingby',
data() {
return {
}
},
created() {},
methods: {}
}
我在這里渲染它。 要約是一個對象:
<component-vallingby v-bind="{ offer: offer }"></component-vallingby>
將prop傳遞給組件:order="order"
。 在組件vm內,在props
數組中將此列為String
。
export default {
name: 'component-vallingby',
props: ['offer']
}
然后實例化組件的傳遞order
如下所示:
<component-vallingby :offer="offer"></component-vallingby>
您需要在export default {}
提到props
。
props: ['offer']
您應該將其綁定為
<component-vallingby :offer="offer"></component-vallingby>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.