问大家个问题,我props传desc对象的时候,为什么会显示undefined呢,我明明设置了默认值
<template>
<transition name="slide">
<div v-show="showFlag" class="food" ref="food">
<ratingselect v-if="desc" :desc="desc" ></ratingselect>
</div>
</transition>
</template>
<script>
import ratingselect from '@/components/ratingselect/ratingselect'
export default {
name: 'food',
data () {
return {
desc: {
all: '全部',
positive: '推荐',
negative: '吐槽'
}
}
},
components: {
ratingselect
}
}
</script>
<template>
<div class="ratingselect">
<div class="rating-type">
<span>{{desc.all}}</span>
<span>{{desc.positive}}</span>
<span>{{desc.negative}}</span>
</div>
<div class="swith">
<span class="icon-check_circle"></span>
<span class="text">只看有内容的评价</span>
</div>
</div>
</template>
<script>
export default {
prop: {
desc: {
type: Object,
default () {
return {
all: '全部',
positive: '满意',
negative: '不满意'
}
}
}
},
data () {
return {
}
}
}
</script>
手掌心
相关分类