12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- export default defineComponent({
- name: 'SdColumn',
- props: {
- prop: String,
- label: String
- },
- setup(props, {slots}) {
- const instance = getCurrentInstance()
- let parent = instance.parent
- parent.exposed.setStore(123)
- console.log(parent.exposed.getStore());
- },
- render() {
- try {
- const renderDefault = this.$slots.default?.({
- row: {},
- column: {},
- $index: -1,
- })
- const children = []
- if (Array.isArray(renderDefault)) {
- for (const childNode of renderDefault) {
- if (
- childNode.type?.name === 'ElTableColumn' ||
- childNode.shapeFlag & 2
- ) {
- children.push(childNode)
- } else if (Array.isArray(childNode.children)) {
- childNode.children.forEach((vnode) => {
- // No rendering when vnode is dynamic slot or text
- if (vnode?.patchFlag !== 1024 && typeof vnode?.children !== 'string') {
- children.push(vnode)
- }
- })
- }
- }
- }
- return h('div', children)
- } catch {
- return h('div', [])
- }
- },
- })
|