2020-09-09 15:49:26 +08:00
|
|
|
import { h } from 'vue'
|
2020-10-26 15:03:02 +08:00
|
|
|
import NCol from '../../src/grid/src/Col.vue'
|
|
|
|
import NRow from '../../src/grid/src/Row.vue'
|
2020-09-09 15:49:26 +08:00
|
|
|
|
2019-09-21 17:03:37 +08:00
|
|
|
export default {
|
|
|
|
name: 'ComponentDemos',
|
2019-10-12 19:08:11 +08:00
|
|
|
props: {
|
|
|
|
singleColumn: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
2020-09-09 15:49:26 +08:00
|
|
|
render () {
|
2020-09-08 22:04:45 +08:00
|
|
|
const defaultSlot = (this.$slots.default && this.$slots.default()) || []
|
|
|
|
// const anchorSlot = (this.$slots.anchor && this.$slots.anchor()) || []
|
2019-10-14 17:49:23 +08:00
|
|
|
// const anchor = [h('div', {
|
|
|
|
// staticClass: 'n-documentation-anchor'
|
|
|
|
// }, anchorSlot)]
|
2019-10-12 19:08:11 +08:00
|
|
|
if (this.singleColumn) {
|
2020-12-12 13:51:22 +08:00
|
|
|
return h(
|
|
|
|
NRow,
|
|
|
|
{
|
|
|
|
gutter: 16
|
|
|
|
},
|
|
|
|
{
|
|
|
|
default: () => h(NCol, { span: 24 }, this.$slots)
|
|
|
|
// h(NCol, { 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)
|
2020-12-12 13:51:22 +08:00
|
|
|
return h(
|
|
|
|
NRow,
|
|
|
|
{
|
|
|
|
gutter: 16
|
|
|
|
},
|
|
|
|
{
|
|
|
|
default: () => [
|
|
|
|
h(
|
|
|
|
NCol,
|
|
|
|
{ span: 12 },
|
|
|
|
{
|
|
|
|
default: () => leftColumn
|
|
|
|
}
|
|
|
|
),
|
|
|
|
h(
|
|
|
|
NCol,
|
|
|
|
{ span: 12 },
|
|
|
|
{
|
|
|
|
default: () => rightColumn
|
|
|
|
}
|
|
|
|
)
|
|
|
|
// h(NCol, { props: { span: 4 } }, anchor)
|
|
|
|
]
|
|
|
|
}
|
|
|
|
)
|
2019-10-12 19:08:11 +08:00
|
|
|
}
|
2019-09-21 17:03:37 +08:00
|
|
|
}
|
|
|
|
}
|