//這個是子組件
<template>
<div class=feedback>
<component :is="comps"></component>
</div>
</template>
<script>
import caseback from './caseback'
import comment from './comment'
import feedback from './feedback'
export default {
components: {caseback, comment, feedback},
props: {
type: Number //父組件根據type的值決定顯示哪一個組件
},
computed: {
comps() {
return ['caseback', 'comment', 'feedback'][this.type]
}
}
}
</script>複製代碼