naive-ui/demo/utils/ComponentDemos.vue

41 lines
1.1 KiB
Vue
Raw Normal View History

2019-09-21 17:03:37 +08:00
<script>
export default {
name: 'ComponentDemos',
2019-10-12 19:08:11 +08:00
props: {
singleColumn: {
type: Boolean,
default: false
}
},
2019-09-21 17:03:37 +08:00
render (h) {
2019-10-14 17:49:23 +08:00
const defaultSlot = (this.$scopedSlots.default && this.$scopedSlots.default()) || []
// const anchorSlot = (this.$scopedSlots.anchor && this.$scopedSlots.anchor()) || []
// const anchor = [h('div', {
// staticClass: 'n-documentation-anchor'
// }, anchorSlot)]
2019-10-12 19:08:11 +08:00
if (this.singleColumn) {
return h('n-row', {
props: {
gutter: 16
}
}, [
h('n-col', { props: { span: 24 } }, defaultSlot)
2019-10-14 17:49:23 +08:00
// h('n-col', { props: { span: 4 } }, anchorSlot)
2019-10-12 19:08:11 +08:00
])
} else {
const leftColumn = defaultSlot.filter((value, index) => index % 2 === 0)
const rightColumn = defaultSlot.filter((value, index) => index % 2 === 1)
return h('n-row', {
props: {
gutter: 16
}
}, [
h('n-col', { props: { span: 12 } }, leftColumn),
h('n-col', { props: { span: 12 } }, rightColumn)
2019-10-14 17:49:23 +08:00
// h('n-col', { props: { span: 4 } }, anchor)
2019-10-12 19:08:11 +08:00
])
}
2019-09-21 17:03:37 +08:00
}
}
</script>