smart-floor.vue
950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<script>
import selectComp from './select-comp';
import banner from './banner';
import hot from './hot';
import tab from './tab';
import sortTab from './sortTab';
import singleImage from './singleImage';
import twoPictures from './twoPictures';
import empty from './empty';
export default {
name: 'smart-floor',
functional: true,
props: {
item: {
type: Object,
required: true
}
},
render(h, ctx) {
function appropriateListComponent() {
var item = ctx.props.item;
if (item.type === 0) return banner;
if (item.type === 1) return hot;
if (item.type === 2) return sortTab;
if (item.type === 3) return singleImage;
if (item.type === 4) return twoPictures;
if (item.type === 'resGoodsPoools') return tab;
return empty;
}
return h(appropriateListComponent(), Object.assign({}, ctx.data, {props: ctx.props.item}), ctx.children);
}
}
</script>
<style>
</style>