Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1x 1x 1x 1x 1x 1x 1x 8x 8x 3x 5x 8x 8x 8x 8x 8x | import './styles/region.styl' import { SELECT, TEXT, GROUP, COLUMN, CITY } from './constants' import SelectGroup from './components/SelectGroup' import TextRegion from './components/Text' import GroupRegion from './components/Group' import ColumnGroup from './components/ColumnGroup' import CityPicker from './components/CityPicker' export default { name: 'v-region', components: { 'r-select': SelectGroup, 'r-text': TextRegion, 'r-group': GroupRegion, 'r-column': ColumnGroup, 'r-city': CityPicker }, props: { type: { type: String, default: SELECT } }, render (h) { Eif (this.type) { switch (this.type.toLowerCase()) { case TEXT: return this.build(h, 'r-text') case SELECT: return this.build(h, 'r-select') case COLUMN: return this.build(h, 'r-column') case CITY: return this.build(h, 'r-city') case GROUP: return this.build(h, 'r-group') } } else { console.error('Please provide selector type.("type" prop of v-region)') } }, methods: { build (h, name) { const slot = [] const options = { class: 'v-region', props: this.$attrs, on: this.$listeners } Iif ('default' in this.$scopedSlots) { switch (this.type.toLowerCase()) { case COLUMN: case GROUP: options.scopedSlots = { default: props => { return this.$scopedSlots.default({ region: props.region, show: props.show }) } } break case CITY: slot.push(this.$scopedSlots.default()) break } } return h(name, options, slot) } } } |