效果:
公共组件:
<template>
<div class="colorTimeTemplate">
<div>123</div>
<div class="colorTimeTemplate-upload">
<slot name="uploadBox"></slot>
</div>
<div>
321
</div>
</div>
</template>
<script>
export default {
name: 'colorTimeTemplate',
components: {},
props: {},
data() {
return {
colorTimeForm: {}
}
},
methods: {},
created() {
},
mounted() {
}
}
</script>
<style lang="scss" scoped>
</style>
使用:
import colorTimeTemplate from './colorTimeTemplate'
components: {colorTimeTemplate},
<div v-if="parseInt(formData.programType) === 3">
<colorTimeTemplate ref="colorTimeTemplate">
<template slot="uploadBox">图片</template>
</colorTimeTemplate>
</div>
<div v-if="parseInt(formData.programType) === 4">
<colorTimeTemplate ref="colorTimeTemplate">
<template slot="uploadBox">视频</template>
</colorTimeTemplate>
</div>