smart-floor.vue 950 Bytes
<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>